woocommerce / woocommerce-square

Square POS and Payments Integration
https://woo.com/products/square
Other
11 stars 7 forks source link

Duplicates on upload/sync #232

Open grig-23 opened 3 weeks ago

grig-23 commented 3 weeks ago

Issue

In 8942863-zen, On upload/sync, we get duplicate products created, and these duplicates correspond to errors such as:

Product #3471 is excluded from sync as the product type "variation" is unsupported.

This results in a stub product in Square where 3471 and it's SKU is showing up in what I would call an orphaned state, , as well as a properly synced product, which contains all the variations, #3471 and #3472 etc.

429 rate limiting causes duplicates #108 but we have reset the batch sizes, and rate limiting errors are no longer occurring.

SOR - WooCommerce Square has a clean DB

The merchant tried cleaning products from Square and re-syncing, only to see more duplicates.

p1730380630885499-slack-C01TYRCJ1QD

nicdwilson commented 1 week ago

I have imported the customers products into a test site, and can replicate the validation error.

Product #3471 is excluded from sync as the product type "variation" is unsupported.

However, my products are not syncing at all to the sandbox: I have no items in the library, WooCommerce is SOR.

I did find some reports that look very similar on the Square forums such as here

qasumitbagthariya commented 1 week ago

QA update:

I attempted to reproduce the issue on my end but was unable to do so. Here's what I tested:

iamdharmesh commented 1 week ago

Hi @grig-23,

Thank you for reporting the issue, and @nicdwilson, thanks for providing the additional details.

I’ve tested this across multiple scenarios but haven’t been able to reproduce the issue. However, I was able to replicate the error Product #XXXX is excluded from sync as the product type "variation" is unsupported by making manual changes to the database. Based on my findings, though, this doesn’t appear to be the root cause of the duplication issue.

I’m not sure what we might be missing when attempting to replicate the issue, but I wonder if it could be related to specific product data? 🤔

I have imported the customers products into a test site, and can replicate the validation error.

@nicdwilson, could you share the exported data of the product causing the issue so I can replicate it on my end and investigate further? Any additional details would also be appreciated.

Thank you!

nicdwilson commented 1 week ago

Hi @iamdharmesh - I can give you full access to the site and sandbox. Possibly that would be easier? It took a while to get the whole thing running :)

We have a thread here: p1730380630885499-slack-C01TYRCJ1QD

However, I was able to replicate the error Product #XXXX is excluded from sync as the product type "variation" is unsupported by making manual changes to the database.

I found that the variations were marked for sync, and removing that in the database removed the error. However, I agree: this is not the source of the duplication. But it is interesting that while my site UI showed over 7000 products (variations + products) to be synced, the merchant's site shows only products (3k products) but still throws the error.

My duplication looks a little different from the merchants. My productsare completely duplicated. There is no "stub"

On my item library, for example, I see Token Item Name SKU WYDQRV6TTPNK7HBLVYVKUZXF Flood Gate Controller 26712 ALX3OE7HZOXN5I2ZOAA7GXUK Flood Gate Controller 26712

While both appear in the logs, only the second ID appears in the DB. This site uses product ID as SKU.

iamdharmesh commented 1 week ago

Hi @iamdharmesh - I can give you full access to the site and sandbox. Possibly that would be easier? It took a while to get the whole thing running :)

Yes @nicdwilson, that would be very helpful. Thanks.

iamdharmesh commented 3 days ago

Thank you for the details, @nicdwilson. I can see duplicate items in my Square dashboard. I will investigate the issue and raise a PR soon. Thanks!