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

Conversation

iamdharmesh
Copy link
Member

All Submissions:

  • Does your code follow the WooCommerce Sniffs variant of WordPress coding standards?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully run tests with your changes locally?
  • Will this change require new documentation or changes to existing documentation?

Changes proposed in this Pull Request:

As reported in #262, when marking a variable product as synced with Square via quick or bulk edit, if the variable product has stock management enabled at the parent level and one of its variations does not have manage stock enabled at the child level, the inventory syncs incorrectly with Square. Upon investigation, I found this occurs because the manage stock setting is not updated to false during quick or bulk edits, unlike when updating a product from the product edit page. This PR ensures that manage stock is set to false for the parent variable product when it is marked as synced with Square via quick or bulk edit and inventory sync is enabled. This change ensures consistent behavior and fixes the inventory sync issue.

Closes #262

Steps to test the changes in this Pull Request:

  1. Create a variable product with stock management enabled at the parent level.
  2. Create two variations: one with stock management enabled and one with stock management disabled.
  3. Publish the product and go to the products list table.
  4. Enable "Sync with Square?" for the created product using bulk or quick edit.
  5. Check the Square dashboard to confirm that tracking is enabled for one variation and disabled for the other.

Changelog entry

Fix - Ensure inventory sync works correctly for variable products when Square sync is enabled through quick or bulk edit.

@qasumitbagthariya
Copy link
Contributor

QA Update ✅


I have verified this PR in the fix/262 branch which has been fixed and is functioning as intended.

I tested the following on this branch:

  • sync with square - Bulk edit
  • sync with square - Quick edit
Square-.bulk.edit.mov
square.-.quick.edit.1.mov

Testing Environment

  • WordPress: 6.7.1
  • Theme: Twenty Twenty-Four 1.3
  • WooCommerce - 9.5.1
  • PHP: 8.0.30
  • Web Server: Nginx 1.20.2
  • Browser: Chrome
  • OS: macOS Ventura 13.3
  • Branch: fix/262

Steps to Test- As mentioned in the PR description.
Test Results - It is working as expected.
Functional Demo / Screencast -
Special Notes - Ready for code review (Woo)
Testing Document status:
Cases related to this Issue/PR are added to the Critical Flow Wiki pages:

  • Yes
  • Not Required/Applicable for this PR

@qasumitbagthariya qasumitbagthariya requested review from a team and Mayisha and removed request for a team January 8, 2025 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

With Woo set as Sync - Variations are incorrectly set to manage stock and backorders disabled
4 participants