[x] 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 #232, when uploading or syncing new products with Square, issues arise when there are a large number of products to sync. The product sync fails, and duplicate products are created on the Square side. This occurred because the upsert limit was too high (500) for new products. As a result, the sync process experiences 429 Too Many Requests errors sometimes. Additionally, in cases of successful requests, time and memory limitations prevent the Square item data from being stored in the product meta, causing the same product to be sent again for upsert, which leads to duplicate products. (It’s worth noting that Square allows the creation of products with the same SKU, which is unusual.)
This PR fixes the upsert process here and reduces the upsert limit from 500 to 25, which enables the plugin to complete the upsert requests and update product data based on the response.
Closes #232.
Closes #247.
Closes #108.
Steps to test the changes in this Pull Request:
Configure the plugin and set WooCommerce as the Source of Record (SOR).
Create a large number of dummy products (2,000–3,000) using WooCommerce Smooth Generator or any other dummy data generation tool or just import products using CSV.
Enable sync for all products. (This could be done by passing "yes" under the "Sync with Square" column in CSV import in step 2)
Start a manual sync from the Square settings.
Verify that the products are properly synced with Square and that no duplicate products are created on the Square side.
#108
Try sending too many requests to Square by following the steps here.
Sending too many requests will result in 429 errors in sync.
Verify no duplicate products are created on the Square side.
All Submissions:
Changes proposed in this Pull Request:
As reported in #232, when uploading or syncing new products with Square, issues arise when there are a large number of products to sync. The product sync fails, and duplicate products are created on the Square side. This occurred because the upsert limit was too high (500) for new products. As a result, the sync process experiences
429 Too Many Requests
errors sometimes. Additionally, in cases of successful requests, time and memory limitations prevent the Square item data from being stored in the product meta, causing the same product to be sent again for upsert, which leads to duplicate products. (It’s worth noting that Square allows the creation of products with the same SKU, which is unusual.)This PR fixes the upsert process here and reduces the upsert limit from
500
to25
, which enables the plugin to complete the upsert requests and update product data based on the response.Closes #232. Closes #247. Closes #108.
Steps to test the changes in this Pull Request:
#108
#247
trunk
branchWooCommerce > Settings > Square > Update
page.listLocations
API call.WooCommerce > Settings > Square > Update
page.listLocations
API call.Changelog entry