1
0
mirror of synced 2025-01-18 08:51:41 +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'] ;
$offer = array('externalId' => $uid);
if (isset($this->settings['bind_by_sku']) && $this->settings['bind_by_sku'] == WC_Retailcrm_Base::YES) {
$offer['xmlId'] = $item->get_product()->get_sku();
$product = $item->get_product();
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);