How to stop specific variants being added to cart?

New Member
1 0 0

I'm having a spot of bother trying to find the best way to sell set, bulk quantities of products. The store I'm building supplies the vast majority of its stock in multiples of 50/100/250/500 etc. In order to avoid customers ordering non-specific quantities, I've removed the quantity box from the product.liquid template and created a variants for a single unit, then each bulk quantity that can be supplied. The single unit serves to provide a 'from' base price, while the additional variants effectively allow the user to buy a 'box of x' at a specific price. I'm using Bold's Product Options app to create a quantity selection option to these variants which ommits the single unit variant, the result being the user can only order from the available bulk quantities.

This all works fine, but what I've found is that when a user adds to cart, the first available variant (in this case the single unit) is also added on top of their selection. That causes a couple of problems...

First of all, the additional item adds an additional cost that wasn't apparent as it isn't included in the running product price created by Product Options. That's not the end of the world as a workaround is to set the first available variant price to £0.00 and use a custom metafield to display the 'from' price, but the variant is still visible in the cart. When a user sees two items listed in the cart where they're expecting to see one, it's going to cause confusion even if the total price isn't affected. 

My next awsome plan was to use Shopify's own variant options soley for quantity selection and produce all the other necessary options in PO (as some products have many more than three customisation options). Unfortunately, I need to apply some conditional logic to the options produced in PO that relys on knowing the quanity that's been selected in the Shopify option list and Bold support tells me that isn't possible. Grrr.

 

So anyway - and this is just a thought - but would there be a way stop a specific product variant (the single unit) being passed to the cart by way of its variant.option1 title? All the single unit variables will have the same option1 title of ‘1’?

Some sort of {% if variant.option1 == ‘1’ %} _code to remove/reduce the quantity to 0_ {% endif %} type thing that could sit in the add-to-cart input or an additional var to pass to shop.js? Any ideas?

 

Thanks

0 Likes
Highlighted
Shopify Staff
Shopify Staff
81 0 11

Hey! This section is related to Shopify Scripts. I'll move your thread to Shopify Design so you can get help

0 Likes