Option to hide out of stock products? #1679
Answered
by
michaelbromley
rebelchris
asked this question in
Q&A
-
Hey everyone! I wanted to know if it's possible to hide all out of stock products from the store front? |
Beta Was this translation helpful? Give feedback.
Answered by
michaelbromley
Jul 25, 2022
Replies: 1 comment 2 replies
-
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 |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
rebelchris
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 theProductVariant.enabled
tofalse
using ProductVariantService.update()