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) {
|
if ($product_data) {
|
||||||
foreach ($product_data as $key => $product) {
|
foreach ($product_data as $key => $product) {
|
||||||
$item = retailcrm_get_wc_product($product['offer'][$this->bind_field], $this->retailcrm_settings);
|
$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) {
|
if ($product['discountTotal'] > 0) {
|
||||||
$item->set_price($product['initialPrice'] - $product['discountTotal']);
|
$item->set_price($product['initialPrice'] - $product['discountTotal']);
|
||||||
}
|
}
|
||||||
@ -885,4 +891,5 @@ if ( ! class_exists( 'WC_Retailcrm_History' ) ) :
|
|||||||
return $outputArray;
|
return $outputArray;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
endif;
|
endif;
|
Loading…
x
Reference in New Issue
Block a user