Skip to content

Commit

Permalink
fix: make commissison value to 0 if no product found (#676)
Browse files Browse the repository at this point in the history
  • Loading branch information
saimonh3 authored and sabbir1991 committed Oct 3, 2019
1 parent cddfcf0 commit 157f1c1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/class.category-walker.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ public function start_el( &$output, $category, $depth = 0, $args = array(), $id
$commission_type = dokan_get_commission_type( dokan_get_current_user_id(), $this->post_id, $category->term_id );
} else {
$commission_val = dokan()->commission->get_earning_by_product( $this->post_id );

if ( is_wp_error( $commission_val ) ) {
$commission_val = 0;
}
}

$pad = str_repeat( ' ', $depth * 3 );
Expand Down
4 changes: 4 additions & 0 deletions lib/class.taxonomy-walker.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ public function start_el( &$output, $category, $depth = 0, $args = array(), $id
$commission_type = dokan_get_commission_type( dokan_get_current_user_id(), $this->post_id, $category->term_id );
} else {
$commission_val = dokan()->commission->get_earning_by_product( $this->post_id );

if ( is_wp_error( $commission_val ) ) {
$commission_val = 0;
}
}

$pad = str_repeat( ' ', $depth * 3 );
Expand Down

0 comments on commit 157f1c1

Please sign in to comment.