1
0
mirror of synced 2025-01-31 07:11:42 +03:00

Skip product if item not found by id

This commit is contained in:
DanielWeiser 2020-07-08 15:54:34 +03:00 committed by GitHub
parent fec8645764
commit ea03321667
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;