Skip to content

Option to hide out of stock products? #1679

Answered by michaelbromley
rebelchris asked this question in Q&A
Discussion options

You must be logged in to vote

Hi Chris!

Good question! Probably the best way to do this right now would be to create a plugin which uses the EventBus to subscribe to the StockMovementEvent. You can then define a function which looks up the current stockOnHand of the associated ProductVariant, and if it is 0, it can set the ProductVariant.enabled to false using ProductVariantService.update()

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@rebelchris
Comment options

@michaelbromley
Comment options

Answer selected by rebelchris
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants