-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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 ENV to disable inventory auto-publish #5149
Conversation
into inventory plugin Signed-off-by: Eric Dobbertin <[email protected]>
into inventory plugin Signed-off-by: Eric Dobbertin <[email protected]>
to inventory plugin Signed-off-by: Eric Dobbertin <[email protected]>
To turn off auto-publish of inventory quantities and related boolean fields. Signed-off-by: Eric Dobbertin <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verified updates function as advertised. Left a code comment
"isSoldOut" | ||
); | ||
|
||
publishedProductVariantFields.push( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not clear an why the variant field are outside of the if statement above? From my understanding, it should be an all or nothing update. Meaning, all inventory fields across top level product variants and options
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@willopez If I am reading the auto-publishing code correctly, then I don't see where it updates those two fields. It auto-publishes the others but not those. So I left them as always needing to be manually published.
I agree it may be best for it to work as you say, all fields, but I would treat that as a separate PR because it's a bigger change and I'm not sure what the ramifications would be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, that sounds good. Lets create another issue to follow up on the other fields in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
"isSoldOut" | ||
); | ||
|
||
publishedProductVariantFields.push( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, that sounds good. Lets create another issue to follow up on the other fields in the future.
Impact: minor
Type: feature
Issue
By default, Reaction auto-publishes inventory quantity changes to the Catalog.
In some cases, due to syncing inventory with external systems, code may want to emit
"afterVariantUpdate"
withfield
set to"inventoryInStock"
but NOT have those changes auto-published to the Catalog.Solution
AUTO_PUBLISH_INVENTORY_FIELDS=false
environment variable can now be used to disable the auto-publishing. If you are editing the inventory "in stock" or "warn at" values manually in the operator UI, you'll see the "changes need publishing" and you'll have to click Publish.Breaking changes
None. The default is
true
.Testing
Without the new ENV set, change the inventory in stock for an option in the UI. Verify:
With the new ENV set, change the inventory in stock for an option in the UI. Verify:
In either case, toggling inventory management or "allow backorder" should NOT result in any updates. Those changes must be manually published with the Publish button.