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

Draft
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Draft
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
5 changes: 5 additions & 0 deletions includes/Handlers/Products.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down
Loading