Skip to content

Commit

Permalink
Saving products on creation so that we have an ID for their children
Browse files Browse the repository at this point in the history
  • Loading branch information
aldavigdis committed Jul 13, 2024
1 parent d9ad1fb commit 87520f1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Import/Products.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ public static function json_to_new_product(

if ( true === $json_object->IsVariation ) {
$wc_product = wc_get_product_object( 'variable' );
$wc_product->save();

$variant_code = ProductVariations::get_product_variant_code_by_sku(
$json_object->ItemCode
Expand Down Expand Up @@ -258,6 +259,7 @@ public static function json_to_new_product(
self::update_variations( $merged_variations, $wc_product );
} else {
$wc_product = wc_get_product_object( 'simple' );
$wc_product->save();
$wc_product->update_meta_data( '1984_dk_woo_origin', 'product' );
}

Expand Down

0 comments on commit 87520f1

Please sign in to comment.