1
0
mirror of synced 2025-03-24 17:13:54 +03:00

Update logic generate icml catalog. Check option 'Manage stocks' and 'Stocks status'

This commit is contained in:
Dima Uryvskiy 2021-07-09 16:02:35 +03:00 committed by GitHub
parent 5979c7cb0e
commit 83e900ba95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -496,6 +496,13 @@ if ( ! class_exists( 'WC_Retailcrm_Icml' ) ) :
$tax = reset($tax_rates);
}
if ($product->get_manage_stock() == true) {
$stockQuantity = $product->get_stock_quantity();
$quantity = empty($stockQuantity) === false ? $stockQuantity : 0;
} else {
$quantity = $product->get_stock_status() === 'instock' ? 1 : 0;
}
$product_data = array(
'id' => $product->get_id(),
'productId' => ($product->get_parent_id() > 0) ? $parent->get_id() : $product->get_id(),
@ -504,7 +511,7 @@ if ( ! class_exists( 'WC_Retailcrm_Icml' ) ) :
'price' => wc_get_price_including_tax($product),
'picture' => $image[0],
'url' => ($product->get_parent_id() > 0) ? $parent->get_permalink() : $product->get_permalink(),
'quantity' => is_null($product->get_stock_quantity()) ? 0 : $product->get_stock_quantity(),
'quantity' => $quantity,
'categoryId' => $term_list,
'dimensions' => $dimensions,
'weight' => $weight,