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

fixed getting sku from product

This commit is contained in:
Круглов Дмитрий 2019-07-25 12:07:20 +03:00
parent 635114633d
commit b8c1305eca

View File

@ -77,8 +77,13 @@ class WC_Retailcrm_Order_Item extends WC_Retailcrm_Abstracts_Data
$uid = ($item['variation_id'] > 0) ? $item['variation_id'] : $item['product_id'] ; $uid = ($item['variation_id'] > 0) ? $item['variation_id'] : $item['product_id'] ;
$offer = array('externalId' => $uid); $offer = array('externalId' => $uid);
if (isset($this->settings['bind_by_sku']) && $this->settings['bind_by_sku'] == WC_Retailcrm_Base::YES) { $product = $item->get_product();
$offer['xmlId'] = $item->get_product()->get_sku();
if (!empty($product) &&
isset($this->settings['bind_by_sku']) &&
$this->settings['bind_by_sku'] == WC_Retailcrm_Base::YES
) {
$offer['xmlId'] = $product->get_sku();
} }
$this->set_data_field('offer', $offer); $this->set_data_field('offer', $offer);