Hi guys - need some guidance. I’m looking to limit...
# general
e
Hi guys - need some guidance. I’m looking to limit the number of products that someone can buy overall + set a limit per product. E.g. only 1 of any particular product + 5 total? What is the best way to implement either and/or both? Any ideas? Thanks in advance!
j
That's an interesting one. I can think of a few ways to do it depending on what you want the user experience to be. You could add callbacks to the checkout controller to kick the customer out to a page with a message if they try to check out with a cart that doesn't meet your restrictions. You'd probably also want to add messaging to the cart step that explains that the user can't check out with the cart and what they need to change. You could also modify the order contents code to make it refuse to add things to the cart beyond your restrictions, and display a useful message at that point.
e
Hi, sorry for the newb questions, but architecturally, when you say “modify the order contents code” are there some callbacks associated with that workflow that you’re referring to, or are you talking about actually monkeypatching the existing code?
j
Order Contents is a configurable class. You can use the existing implementation as a base, customize it to your needs, and then configure solidus to use it. The configuration option is called
order_contents_class
.
e
Thanks, I’ll check that out
I appreciate the heads up