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

With Woo set as Sync - Variations are incorrectly set to manage stock and backorders disabled #262

Closed
kaushikasomaiya opened this issue Jan 1, 2025 · 10 comments · Fixed by #264
Assignees
Labels
priority: high The issue/PR is high priority—if affect lots of customers substantially, but not critically.
Milestone

Comments

@kaushikasomaiya
Copy link

kaushikasomaiya commented Jan 1, 2025

8942863-zen

Let's say we have a variable product with two variations.

At global level:

  • Enable manage stock
  • Allow backorders

https://d.pr/i/c56IIg
Full Size: https://d.pr/i/c56IIg

This means the variations which do not have manage stock enabled are expected to follow global settings.

  • Variation A: Set manage stock enabled with any stock number, allow backorder
  • Variation B: Do not manage stock so that it follows global settings.

Keep Square plugin turned off while creating the product above, and once ready enable Square and set to sync.

The product gets synced to Square however Variation B is marked as "track" stock on Square. A pull inventory action modifies Variation B on Woo and sets stock management on it with backorders disabled.

https://d.pr/i/6TBvR3

The net result of this is despite global setting being set to allow backorders, as soon as inventory goes 0 or negative Variation B is out of stock on Woo for customers.

Sidenote: The reason I turned off Square while creating a variable product is because I feel the wc-square-admin-products.js is buggy and has multiple issues. For instance, strings like these appearing on checking / unchecking the sync, under inventory the Stock Quantity box visible though manage stock is unchecked, and the other issue I reported here #261. I feel the script needs to be thoroughly reviewed for consistency.

@kaushikasomaiya
Copy link
Author

Merchant described the issue a bit differently but I think it is the same as the issue above:

For example, when an order comes through online despite if the item is set in Square to be tracked or not once the sale happens, Square then automatically starts tracking that item, as Square wouldn't have had any stock recorded for this item the stock level goes into negatives.

The issue with this is that WC then marks the inventory as out of stock preventing future customers from purchasing.

Further description:

The Issue:
When a sale comes in to WC, Square tracks the inventory for this item despite the tracking setting. When an item has no stock recorded against it in Square, which is the case for 90% of items, Square will then activate tracking and record as a "-1 negative stock level".

When Square identifies a product that has no stock or shows a negative stock count it tells WC that this item is out of stock, WC then updates the stock status and prevents future sales of this item despite the tracking setting in both WC and Square.

The Current Solution:
Requires us to log into Square, deactivate tracking again, logging into WC and changing the status to "in stock" and then the product can be purchased again online, once the item is sold once more we need to repeat the process.

Though I am a bit confused about the -1 value appearing after tracking is disabled on Square.

Global:
https://d.pr/i/xC4NOP
Variation:
https://d.pr/i/dnY681
Square:
https://d.pr/i/IynVel

@vikrampm1 vikrampm1 added priority: high The issue/PR is high priority—if affect lots of customers substantially, but not critically. type: bug The issue is a confirmed bug. labels Jan 2, 2025
@iamdharmesh iamdharmesh self-assigned this Jan 3, 2025
@iamdharmesh
Copy link
Member

Hi @kaushikasomaiya,

Thank you for reporting the issue.

The product gets synced to Square however Variation B is marked as "track" stock on Square. A pull inventory action modifies Variation B on Woo and sets stock management on it with backorders disabled.

I attempted to create a product and sync it with Square, and it worked correctly on my end. "Tracking" is not being enabled on the Square side, and there are no changes during the pull inventory action. Could you please confirm if stock tracking is being enabled by Square systems like the online store (as mentioned in the comment) or if tracking is enabled since the initial sync for you? If yes could you please help with more detailed steps here?

Regarding backorders, we do not update this during inventory updates, so it remains the default WooCommerce value. However, during product import (when we import products by clicking the import button), it gets updated to "Do not allow", but that is more of a Square SOR thing.

@qasumitbagthariya Could you please try reproducing this issue on your end?

For example, when an order comes through online despite if the item is set in Square to be tracked or not once the sale happens, Square then automatically starts tracking that item, as Square wouldn't have had any stock recorded for this item the stock level goes into negatives.

By "order comes through online" merchant means Square online store here?

Thank you.

@kaushikasomaiya
Copy link
Author

kaushikasomaiya commented Jan 3, 2025

Hi @iamdharmesh Thank you for looking into it

  1. I disabled the Square plugin while creating a product because of the buggy admin script.
  2. Published a variable product with global settings set to manage stock and back orders allowed
  3. Added two variations - one with manage stock enabled and one with manage stock disabled so that it follows global settings
  4. Enabled Square plugin, mark the product to sync with square (Woo SOR and inventory sync enabled) and let the sync kick in
  5. When this variable product is imported first time on my sandbox Square account, stock tracking for both variations is enabled on Square while it should be only for the first one.
  6. Pull action then marks stock management enabled on the other variation (B) and sets the backorders "not allowed" on Woo

When I disable stock tracking on Square for Variation B, further things appear fine it never gets enabled again.

Does this help?

Merchant mentioned their simple products which don't have manage stock enabled are also getting tracked on Square and -1 is set as inventory which is then pulled back. However I think this is a different issue if at all, and might be a conflict so I've asked for more details.

@qasumitbagthariya
Copy link
Contributor

Hello @kaushikasomaiya

Thanks for the detailed comment.

I followed the steps you provided to reproduce the issue but was unable to replicate it. Please refer to the attached video for more details. Let me know if I missed anything or if there's anything else you'd like me to check.

Screen.Recording.2025-01-06.at.4.05.25.PM.1.mov

cc @iamdharmesh

@kaushikasomaiya
Copy link
Author

kaushikasomaiya commented Jan 6, 2025

Hi @iamdharmesh @qasumitbagthariya

Please find the video below of both issues (262 and 261, around 1:47, you'll see issue 261)

https://d.pr/v/zXMeJf

@iamdharmesh
Copy link
Member

Thanks for providing the video, @kaushikasomaiya. I was enabling 'Sync with Square?' from the product edit screen, and it was working fine there. The issue was occurring when 'Sync with Square?' was enabled via bulk or quick edit. I’ve raised #264 to fix it. Also, I’m not able to replicate issue 261 on my side as shown in the video, but I’ll investigate further when we start looking into it.

@iamdharmesh iamdharmesh added this to the Future Release milestone Jan 7, 2025
@jeffpaul jeffpaul removed the type: bug The issue is a confirmed bug. label Jan 13, 2025
@kaushikasomaiya
Copy link
Author

Hi @iamdharmesh and team,

Just had a couple of questions around pull_inventory (with Woo SOR and inventory sync enabled)

  • Let's say I have a simple product not set to sync currently
  • I don't have stock management enabled on it
  • Enable sync on it
  • It gets synced to Square
  • If I set the product Out of Stock in Woo, pull_inventory marks it in stock again because it is instock on Square
  • The out of stock value is not reflected on Square on manually syncing (product not marked out of stock on Square)

I am trying to understand what should be the ideal behaviour here.

@iamdharmesh
Copy link
Member

Hi @kaushikasomaiya,

Thank you for your questions. This is expected behavior or perhaps more accurately a known issue. When we sync a product with stock management disabled it disables the tracking on the Square side and whenever tracking is disabled on the Square side, the product is updated as "in stock" in WooCommerce with "manage stock" disabled. We currently have an open issue for this: #21.

This issue was on hold because the sold_out field was in BETA in the API. Now that it's out of BETA, we can prioritize it and begin working on it. There are two key points to note about this behavior:

  • Inventory Sync: Inventory is always pulled from Square to account for stock updates on the Square side (e.g., POS transactions), even when WooCommerce is set as SOR. For Woo SOR, Inventory only syncs from Woo to Square during the initial sync or when stock quantity is updated on the product edit page by clicking "Fetch stock from Square."

  • Stock Tracking Behavior: Currently, when stock tracking is disabled for a product on the Square side, the product is updated as "in stock" in WooCommerce with "manage stock" disabled. As mentioned above, this is due to issue [Inventory Sync] Sync the "Mark as sold out" field value during inventory sync. #21, and resolving it will fix the overall behavior.

Hope this makes things clear, but please feel free to ask if you need any further information or have any questions.

Thank you.

@kaushikasomaiya
Copy link
Author

Hi @iamdharmesh Thanks for fixing this. Just sharing the results of investigation done on this merchant's ticket - I think a import was done with 800~ variable products set to manage stock and no stock value (NULL) and this got synced to Square - this is why Pull Inventory was marking the variations to manage stock. I think regardless this fix, the issue can be replicated if a bulk import is done via default Woo importer or other tool with Stock management enabled on parent and Sync column in the CSV set to yes. Maybe it is more of something the merchants need to be aware of while importing products when Square and inventory sync are enabled.

@iamdharmesh
Copy link
Member

Hi @kaushikasomaiya,

Thanks for sharing this information. We already display a notice on the product import screen regarding inventory sync. However, this is something that merchants can easily miss.

I will check the best way to handle this and will update you here soon. Thanks for providing all this important information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: high The issue/PR is high priority—if affect lots of customers substantially, but not critically.
Projects
None yet
5 participants