How does Liquid object quantity_rule work?

How does Liquid object quantity_rule work?

newbie_01
Shopify Partner
34 0 13

According to docs, Liquid offers a quantity_rule object, with 3 properties: min, max, increment.

I'm curious where are these properties pulled from, where should they be stored so Liquid can pull them and offer them to the front end.

They seem to be connected to the variant object, but on the back end the ProductVariant object doesn't have that field.

Thanks for any assistance.

Replies 6 (6)

made4Uo
Shopify Partner
3851 717 1195

Hi @newbie_01 

 

Interesting. This seems to be new. You can use the following rule to set up the product variant quantity. I believe this is something to do with the changelog in Shopify. You can see this code being use in the Shopify FREE themes, inside the main-product.liquid under the Section folder. 

 

made4Uo_1-1683525563074.png

 

If this fixed your issue Likes and Accept as Solution is highly appreciated. Coffee tips fuels my dedication.
Get EXPERIENCED Shopify developers at affordable rates—visit Made4Uo.com for quick quote!
Do not lost your Shopify store! Get FREE trial with ✔️ Rewind Backup: Automatic, reliable, stress-free
newbie_01
Shopify Partner
34 0 13

Thanks.

Yes, the code in the theme looks very promising, but I can't find where is the actual data (min,max,increment) stored for each variant.

Good find on that changelog entry. It mentions catalogs. I tried making a new catalog but couldn't find quantity data there either.

thethninaye
Visitor
3 0 0

Did you find the solution to your case? We are having a similar case where we want to specify increment quantity for each product and use it in the store front end? 

Made4uo-Ribe
Shopify Partner
8274 1985 2436

HI @newbie_01 

 

This is only available in B2B commerce stores. You can see documentations here

If this fixed your issue Likes and Accept as Solution is highly appreciated. Coffee tips fuels my dedication.
Get EXPERIENCED Shopify developers at affordable rates—visit Made4Uo.com for quick quote!
Do not lost your Shopify store! Get FREE trial with ✔️ Rewind Backup: Automatic, reliable, stress-free.
Need THEME UPDATES but has custom codes? No worries, contact us for affordable price.
newbie_01
Shopify Partner
34 0 13

That's a bummer, but at least we have an answer. Thanks!

jam_chan
Shopify Partner
920 23 188

Is it used for the new cart and checkout validation API? But I can't find any docs mentioning that

BYOB - Build Your Own Bundles, SPO - SEO App to research keywords & edit social link preview