Shopify B2B Quantity Rules Not Showing in Liquid? Here's the Fix!
Hey there, fellow store owners!
Ever felt like you're doing everything right with your Shopify B2B setup, following the docs to a T, only to find things aren't quite behaving as expected on your storefront? You're definitely not alone. I recently stumbled upon a really insightful discussion in the Shopify community that hits on a common pain point for those of us leveraging Shopify's B2B capabilities, particularly around product quantity rules.
The gist? Configured B2B catalog quantity rules (think minimum order quantities, increment steps, or maximums) sometimes just don't show up correctly in your theme's Liquid code. It's a head-scratcher, especially when the Cart API confirms everything is set up perfectly in the backend. Let's dive into what the community uncovered and how you can tackle this.
The Case of the Stubborn Quantity Rules
Our community member, bencar02, kicked off the discussion with a problem many of you might recognize. They were diligently setting up a development store's B2B catalog, complete with specific quantity rules for products – like a minimum of 3 items, or increments of 3. The good news was that the Cart API was respecting these rules; if you tried to add 2 items, it would block you, or if you tried 4, it would adjust to 3 or 6. So, the backend setup was solid!
The frustrating part? The theme Liquid, specifically using something like product.selected_or_first_available_variant.quantity_rule, just wasn't playing along. Instead of reflecting the custom B2B rules, it would stubbornly default to the standard "minimum 1, increment 1". This meant the quantity input fields on the product page weren't guiding customers correctly, leading to a disjointed experience. Bencar02 even shared a screenshot of the logged Liquid output, clearly showing the default values:

They'd even tried debugging with AI assistants, only to be told it wasn't possible, despite Shopify's own documentation suggesting the opposite. Sound familiar?
"It's a Shopify-Side Rendering Issue" – Community Confirms a Known Bug
Thankfully, another helpful community member, Moeed, jumped in with some crucial insights. Moeed confirmed what many might have suspected: this isn't a setup error on your part. It's a known "Shopify side rendering issue" where the Cart API correctly understands your B2B catalog rules, but Liquid struggles to pull those specific variant.quantity_rule values into the theme.
Moeed even pointed to an existing thread on the Shopify Developer Community, titled "Inconsistent B2B Quantity Rule and Volume Pricing Data," which describes this exact situation. This is a huge relief, as it means you're not crazy for thinking something was off!
Before You Implement a Workaround: Essential Checks
While it's likely a bug, Moeed wisely suggested a few critical checks to make sure you're not overlooking something fundamental. It's always good practice to rule these out first:
- Are You Fully in B2B Context?
This might seem obvious, but it's easy for one piece to be missing. Your test customer needs to be:
- Logged in.
- Tied to a company location.
- That company location needs to have the B2B catalog with your specific quantity rules assigned.
{{ customer.b2b? }}and{{ customer.current_location.id }}. Both should return "truthy" values (i.e.,truefor the first, and an ID for the second). - Theme Version Matters! B2B quantity rules in Liquid are a newer feature. Ensure your theme is up to date. You'll need a free Shopify theme version 8.0.0 or higher for these rules to even have a chance of rendering correctly in Liquid.
- Test Against Your Published Theme. This is a subtle but important one. The bug can surface differently depending on your development environment. Moeed noted that the referenced dev forum thread indicated inconsistencies between testing on a CLI preview versus a published theme. Always double-check on your live (or a duplicate, unpublished) theme.
If you've gone through all these checks and everything looks good on your end, then congratulations (or commiserations!), you're likely hitting the documented bug.
The Recommended Workaround: Embrace JavaScript
So, if Liquid isn't playing nice, what's the solution? As bencar02 hinted, and Moeed confirmed, custom JavaScript is your best bet. And here's the kicker: it's not really a "brute-force hack" as it might feel. Shopify's own documentation often uses JavaScript to fetch updated data, especially for dynamic elements like variant changes.
The strategy is to bypass the inconsistent Liquid output for variant.quantity_rule and instead fetch the correct, real-time rules using JavaScript directly from Shopify's APIs. Here's how you can approach it:
- Identify the Variant ID: On your product page, you'll need the currently selected variant's ID. This is usually available via Liquid (e.g.,
product.selected_or_first_available_variant.id) or from your variant selector's change events. - Fetch Variant Data: Use JavaScript to make an AJAX request to the
/variants/{id}.jsendpoint. This endpoint returns a JSON object with comprehensive data for that specific variant, including the correctquantity_ruleobject.fetch('/variants/' + variantId + '.js') .then(resp> response.json()) .then(variant => { const quantityRule = variant.quantity_rule; // Now you have the correct rules! Update your quantity input fields. console.log('Min quantity:', quantityRule.min); console.log('Increment:', quantityRule.increment); console.log('Max quantity:', quantityRule.max); }) .catch(error => console.error('Error fetching variant data:', error)); - Alternatively, Use the Cart API: If you need even more context or are already interacting with the cart, you can leverage the Cart API. It reliably returns the correct catalog rules within the B2B session.
- Update Your Quantity Inputs: Once you have the accurate
min,increment, andmaxvalues from the fetched variant data, use JavaScript to dynamically update the attributes of your quantity input fields (e.g.,min="3",step="3",max="100"). This ensures your UI accurately reflects the B2B rules.
This approach might require a bit more development effort upfront, but it guarantees that your B2B customers see the correct quantity rules and have a smooth ordering experience, aligning with your backend catalog settings.
Your Voice Matters: Engage the Developer Community
As Moeed emphasized, if you're hitting this bug, documenting your findings and sharing them on the Shopify Developer Community is incredibly valuable. That's where Shopify's own developers actively engage, and where widespread reports can help prioritize a fix. Bencar02 even mentioned they were planning to do just that, which is fantastic for the whole ecosystem.
So, there you have it. If your B2B quantity rules are acting up in Liquid, you're likely facing a known issue. Don't pull your hair out! Go through those essential checks, and if it's the bug, confidently implement a JavaScript solution. It's a reliable path to ensuring your B2B store provides the seamless experience your customers expect. Keep building, keep optimizing, and keep sharing your insights – that's how we all grow stronger together in the Shopify community!