Skip to content

Commit 95612ee

Browse files
Update plugins/woocommerce/src/Internal/CLI/Migrator/Core/WooCommerceProductImporter.php
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent 06e7f21 commit 95612ee

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

plugins/woocommerce/src/Internal/CLI/Migrator/Core/WooCommerceProductImporter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,12 +519,12 @@ private function handle_simple_product( WC_Product_Simple $product, array $produ
519519
$product->set_stock_status( $product_data['stock_status'] );
520520
}
521521

522-
if ( ! empty( $product_data['cost_of_goods'] ) ) {
522+
if ( array_key_exists( 'cost_of_goods', $product_data ) ) {
523523
$cogs_is_enabled = FeaturesUtil::feature_is_enabled( 'cost_of_goods_sold' );
524524
if ( $cogs_is_enabled ) {
525525
$product->set_cogs_value( (float) $product_data['cost_of_goods'] );
526526
} else {
527-
// works when cogs is disabled.
527+
// Store COGS directly when the feature is disabled; use product meta API so it persists on save.
528528
$this->set_cogs_value_direct( $product, (float) $product_data['cost_of_goods'] );
529529
}
530530
}

0 commit comments

Comments
 (0)