Skip to content

Commit

Permalink
Fixing product variant sync
Browse files Browse the repository at this point in the history
Product variations were being converted into single products during a downstream sync. This should fixed that.

Variations are now also caught during a upstream sync.
  • Loading branch information
aldavigdis committed Jul 2, 2024
1 parent 8fc9932 commit c5e98dd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/Hooks/WooUpdateProduct.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ public function __construct() {
2
);

add_action(
'woocommerce_update_product_variation',
array( __CLASS__, 'on_product_update' ),
10,
2
);

add_action(
'before_delete_post',
array( __CLASS__, 'before_post_delete' ),
Expand Down
2 changes: 1 addition & 1 deletion src/Import/Products.php
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ public static function update_product_from_json(
int $product_id,
stdClass $json_object
): WC_Product|false {
$wc_product = new WC_Product( $product_id );
$wc_product = wc_get_product( $product_id );

if ( ! ( $wc_product instanceof WC_Product ) ) {
return false;
Expand Down

0 comments on commit c5e98dd

Please sign in to comment.