Skip to content

Set default inventory tracking to false when the track_inventory key is missing in sync and product handlers.#433

Merged
vikrampm1 merged 1 commit intotrunkfrom
fix/square-214
Jan 14, 2026
Merged

Set default inventory tracking to false when the track_inventory key is missing in sync and product handlers.#433
vikrampm1 merged 1 commit intotrunkfrom
fix/square-214

Conversation

@m-muhsin
Copy link
Collaborator

@m-muhsin m-muhsin commented Dec 9, 2025

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:

When products are imported to Square via CSV with inventory tracking disabled, the Square API response does not include the track_inventory field. The current code defaults this missing field to true, which incorrectly enables "Manage Stock" in WooCommerce, resulting in products showing as "Out of Stock."

Products created directly in Square's dashboard work correctly because they explicitly set track_inventory: false in the API response.

This PR changes the default value from true to false when the track_inventory key is missing, ensuring CSV-imported products without inventory tracking are correctly imported as "In Stock" with stock management disabled.

Closes https://linear.app/a8c/issue/SQUARE-214/csv-imported-products-with-non-tracked-inventory-are-set-to-manage.

Steps to test the changes in this Pull Request:

  1. Import a product to Square using the CSV import feature with "location availability" enabled but "stock tracking" disabled.

Use this test.csv file if needed.

  1. Verify in the Square dashboard that the product has location availability enabled but stock tracking disabled.
  2. In WooCommerce, go to WooCommerce → Settings → Square and run a product import/sync.
  3. Navigate to the imported product in WooCommerce and check its inventory settings.
  4. Expected: The product should show as "In Stock" with "Manage stock?" set to disabled (unchecked).
  5. Before fix: The product incorrectly showed as "Out of Stock" with "Manage stock?" enabled and quantity set to 0.

Additional verification:

  1. Create a product directly in Square's dashboard with stock tracking disabled.
  2. Import this product to WooCommerce.
  3. Verify both products (CSV-imported and dashboard-created) now behave consistently, both showing as "In Stock" with stock management disabled.

Changelog entry

Fix - CSV-imported products from Square with inventory tracking disabled are now correctly imported as "In Stock" instead of "Out of Stock" with stock management enabled.

…y is missing in sync and product handlers.
Copy link
Collaborator

@qasumitbagthariya qasumitbagthariya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QA Update ✅


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

I tested the following on this branch:

image image

Testing Environment

Details
  • WordPress: 6.9
  • Theme: Storefront 4.6.2
  • Theme: Twenty Twenty-Five 1.4
  • WooCommerce - 10.4.0
  • PHP: 8.0.30
  • Web Server: Nginx 1.20.2
  • Browser: Chrome
  • OS: macOS 15.2
  • Branch: fix/square-214

Steps to Test- As mentioned in the PR description.
Test Results - It is working as expected.
Functional Demo / Screencast -
Special Notes - Ready for UAT
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
Copy link
Collaborator

Regression / Smoke Test Report ✅

Tested with Archive File created via "php woorelease.phar build repo_URL" (Composer version 2.8.4, npm version 10.8.2, node version 20.18.1)

Status- Working expected with Plugin Archive/Zip file same as fix specific branch.

Testing Environment

Details
  • WordPress: 6.9
  • Theme: Storefront 4.6.2
  • Theme: Twenty Twenty-Five 1.4
  • WooCommerce - 10.4.3
  • PHP: 8.0.30
  • Web Server: Nginx 1.20.2
  • Browser: Chrome
  • OS: macOS 15.2
  • Branch: smoke-testing

Next Step- Ready to Merge 🚀

@vikrampm1 vikrampm1 added this to the 5.2.0 milestone Jan 14, 2026
@vikrampm1 vikrampm1 marked this pull request as ready for review January 14, 2026 20:42
@vikrampm1 vikrampm1 merged commit 8117a78 into trunk Jan 14, 2026
13 of 15 checks passed
@vikrampm1 vikrampm1 deleted the fix/square-214 branch January 14, 2026 20:43
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.

4 participants