Skip product if item not found by id
This commit is contained in:
parent
fec8645764
commit
ea03321667
@ -610,6 +610,12 @@ if ( ! class_exists( 'WC_Retailcrm_History' ) ) :
|
||||
if ($product_data) {
|
||||
foreach ($product_data as $key => $product) {
|
||||
$item = retailcrm_get_wc_product($product['offer'][$this->bind_field], $this->retailcrm_settings);
|
||||
if (!$item) {
|
||||
$logger = new WC_Logger();
|
||||
$logger->add('retailcrm', 'Product not found by ' . $this->bind_field);
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($product['discountTotal'] > 0) {
|
||||
$item->set_price($product['initialPrice'] - $product['discountTotal']);
|
||||
}
|
||||
@ -885,4 +891,5 @@ if ( ! class_exists( 'WC_Retailcrm_History' ) ) :
|
||||
return $outputArray;
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
endif;
|
Loading…
x
Reference in New Issue
Block a user