Wine Woes Solved: Mastering Multiples & Vendor Restrictions on Shopify Basic
Taming the Wine Cart: A Shopify Basic Challenge
Running a wine marketplace on Shopify Basic can be tricky, especially when you need custom rules that go beyond the standard settings. We recently saw a great question pop up in the community from JustGrapes who was facing a common challenge: enforcing specific quantity rules per vendor for mixed wine cases. Let's dive into the issue and explore the solutions that were discussed.
The Core Problem: Multiples of 6, Per Vendor
JustGrapes needed to ensure customers bought wine in multiples of 6, but with a twist! This rule had to apply to each vendor individually. So, if a customer had 3 bottles from one winemaker and 3 from another, they shouldn't be able to checkout until they hit that 6-bottle minimum for each vendor. A tough nut to crack on Shopify Basic, where you don't have access to Shopify Functions for checkout validation.
Here were the requirements laid out by JustGrapes:
- Mixed Multiples: Customers must buy in multiples of 6 (6, 12, 18, etc.) per order. The 6 bottles can be from different products (mixed cases) per vendor
- Per Vendor Restriction: Because this is a marketplace, the “Multiple of 6” rule must apply per vendor. If a customer has 3 bottles from Winemaker A and 3 bottles from Winemaker B, they should be blocked from checking out until they have 6 from each.
Existing apps often fall short, focusing on single-product multiples or overall cart minimums. JustGrapes needed something that understood the "Vendor" attribute and could enforce a "Step/Multiple" of 6 for each vendor group.
The Community Brainstorm: Apps vs. Code
The initial question was whether any "Order Limit" apps could handle this on the Basic plan, grouping by vendor. Apps like MinMaxify and Limitsify were mentioned, but their ability to handle "multiples/steps" for a vendor group was uncertain.
The other avenue explored was using JavaScript/Liquid snippets on the cart.liquid page. The idea was to hide the "Checkout" button unless each vendor's count was a multiple of 6.
Diving into the Code: A Template-Based Approach
One community member, Maximus3, suggested a code-based solution involving template customization. This approach focuses on manipulating the quantity selector and using Liquid logic. Here's a breakdown of the steps:
- Duplicate the Product Page Template: Create a new template (e.g., "custom product") to avoid modifying the default.
- Locate the Quantity Selector: This is usually in
product-form.liquid,main-product.liquid, or a referenced file. Use the "Edit Code" feature and search to find it. - Duplicate the Product Form File: Create a copy (e.g., "custom product form") to customize.
- Conditional Rendering: In
main-product.liquid, use Liquid to render the custom form for products using the "custom product" template:{% if product.template_suffix == 'custom-product' %} {% render 'custom-product-form' %} {% else %} {% render 'product-form' %} {% endif %} - Modify the Quantity Selector: In the "custom product form", change the
stepattribute to 6. You might also need to set theminimumto 6. - Hide the Original Selector (Optional): Create a new "cases" input and use JavaScript to link it to the hidden quantity selector. This provides a cleaner user interface.
- Update the Cart Display: Use Liquid to show the number of cases:
{% assign cases = item.quantity | divided_by: 6 %} {{ cases }} case{% if cases > 1 %}s{% endif %}
Excluding Pre-Mixed Cases: Adding Complexity
JustGrapes added another layer of complexity: pre-mixed cases (tagged as "case" or in a "case" collection) should be excluded from this rule. These are already sold in multiples of 6 or 12. This requires adding conditional logic to the code to bypass the quantity enforcement for these specific products.
This could be achieved by checking for the tag or collection within the Liquid code that modifies the quantity selector. For example:
{% unless product.tags contains 'case' or product.collections contains 'case' %}
{% endunless %}
Remember to adjust this snippet to match your specific tag or collection name.
Wrapping Up: A Blend of Logic and Creativity
While a direct app solution for this specific scenario on Shopify Basic might be elusive, the combination of template customization and Liquid/JavaScript snippets offers a viable workaround. It requires a bit of coding knowledge, but it provides the flexibility to enforce those crucial vendor-specific quantity rules. Remember to thoroughly test your changes in a development environment before pushing them live to your store! It's all about finding creative solutions to tailor Shopify to your unique business needs, especially when working with the limitations of the Basic plan.