Skip to content

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

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