Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix inventory sync for variable products when sync is enabled through quick or bulk edit. #264

Merged
merged 1 commit into from
Jan 17, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix inventory sync for the variable product when sync enabled from qu…
…ick/bulk edit.
iamdharmesh committed Jan 7, 2025
commit 02e9be89236578471c0b2fa5d5648c241d30ff7f
5 changes: 5 additions & 0 deletions includes/Handlers/Products.php
Original file line number Diff line number Diff line change
@@ -553,6 +553,11 @@ public function set_synced_with_square( $product ) {
if ( is_string( $square_synced ) ) {
$errors = $this->check_product_sync_errors( $product );
if ( 'no' === $square_synced || empty( $errors ) ) {
if ( 'yes' === $square_synced && $product->is_type( 'variable' ) && wc_square()->get_settings_handler()->is_inventory_sync_enabled() ) {
// if syncing inventory with Square, parent variable products don't manage stock
$product->set_manage_stock( false );
}

Product::set_synced_with_square( $product, $square_synced );
} elseif ( ! empty( $errors ) ) {
foreach ( $errors as $error ) {