Skip to content

Commit

Permalink
fixed getting sku from product
Browse files Browse the repository at this point in the history
  • Loading branch information
Круглов Дмитрий committed Jul 25, 2019
1 parent 6351146 commit b8c1305
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/include/order/class-wc-retailcrm-order-item.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,13 @@ private function set_offer(WC_Order_Item_Product $item)
$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);
Expand Down

0 comments on commit b8c1305

Please sign in to comment.