-
Notifications
You must be signed in to change notification settings - Fork 10
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
Add support for syncing the "Mark as Sold Out" field value during inventory sync. #277
base: trunk
Are you sure you want to change the base?
Conversation
I think I agree, this is fine for the initial implementation as long as we document this. If we get customer requests to change this, we can look into that at that point |
QA Update ✅I have verified this PR in the I tested the following on this branch:
Square_step1_out.of.stock.movStep-2In.stock.movStep-3.sold.out.-.run.event.movFuture.Time.in.Square.1.movNote: I've record a testing videos for Square - SOR Testing Environment
Steps to Test- As mentioned in the PR description.
|
All Submissions:
Changes proposed in this Pull Request:
As mentioned in #21, on the Square side, we can mark an inventory-tracking-disabled product as "Out of Stock" using the "Mark as Sold Out on Point of Sale and Online" option. However, currently, when inventory tracking is disabled for a product in Square, it always updates the stock status to "In Stock," regardless of the value of the
sold_out
field.This PR adds support for the
sold_out
field, ensuring it is considered during inventory sync and updating the stock status to "Out of Stock" whenever a product is marked as sold on the Square side while inventory tracking is disabled.Notes
The
![image](https://private-user-images.githubusercontent.com/10613171/409106522-184ddab8-8b64-429d-924c-76b6f7ffd6f2.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2MjcxMzksIm5iZiI6MTczOTYyNjgzOSwicGF0aCI6Ii8xMDYxMzE3MS80MDkxMDY1MjItMTg0ZGRhYjgtOGI2NC00MjlkLTkyNGMtNzZiNmY3ZmZkNmYyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE1VDEzNDAzOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTFmMWY0YjE0ZjUwY2NiZjk0ZDBmZDBiMTM0OThhZWU3ZmRkYzc3MDg0ZDgwNDg5ODg0NDY0M2VhZTE5NGM1MmYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.qW34RpUUwwGl_guHE2zz2JA8oyGbZqIIucpsZ1B8XDs)
sold_out
field is read-only, so using API we can't mark Square products as sold out while keeping inventory tracking disabled. The closest alternative is to mark the product as sold out with inventory tracking enabled. This means enabling inventory tracking and setting the stock value to0
, which will reflect on the WooCommerce side as well since stock levels are pulled from Square during inventory sync.When we mark an item as sold out, Square allows us to set a time for it to become available again. At that time, it will automatically be marked as in stock. I didn’t add support for this in this PR, as we already have a sync running every 15 minutes (interval polling). The product will become available within 15 minutes once it is marked as available on the Square side, which I think is acceptable. @dkotter, please let me know if you think we should sync this in real time. We could schedule an Action Scheduler task for the specific availability time, but if the number of products is high, this would increase the number of scheduled actions. Since 15 minutes is a relatively short interval, it should be fine for now. However, we can consider implementing real-time syncing if we receive customer requests for it.
![image](https://private-user-images.githubusercontent.com/10613171/409107499-47e0c89a-4ddf-4e75-b051-81c06f6f34f1.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2MjcxMzksIm5iZiI6MTczOTYyNjgzOSwicGF0aCI6Ii8xMDYxMzE3MS80MDkxMDc0OTktNDdlMGM4OWEtNGRkZi00ZTc1LWIwNTEtODFjMDZmNmYzNGYxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE1VDEzNDAzOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTYyOGMxMmJjM2I1MWMyN2YzYmE4YjY0ZWVmMjI0YmZkNmY3YzNlMTc3NjZlYjZmMDE5YjJlMGIwMDU5NTlmMTgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.RcGbGiUZpcQ77U6ZmzSbXFSUgX_2DvTiny4v8na5he8)
Closes #21
Steps to test the changes in this Pull Request:
Square SOR:
WooCommerce
>Settings
>Square
>Update
. Click the Sync button and wait for the sync process to complete.Tools
>Scheduled Actions
by manually running thewc_square_sync
action.Woo SOR:
0
.Changelog entry