Top

Require Customer with a Specific Tag to Have a Minimum Cart Quantity for all Products before Checkout

Warning!

This is an unsupported theme customization. You can request this customization by emailing our Professional Services Team.

Customer Specific Pricing is designed to create price points for different types of customers (wholesale, trade, VIP and more). Customization can be done for stores that require their customers, with a specific tag, to reach a predefined cart quantity for all products before checking out.

Note: This will not work with an Ajax theme (also known as a "slide","drawer", or "pop-out" cart).

  1. From "Shopify Admin", select Online Store.

    select online store 

  2. Select Actions.

    Select Actions 

  3. Select Edit code.

    Select Edit code 

  4. Under "Templates", select cart.liquid.

    Note: If your theme contains sections, this may be found under "sections" in cart-template.liquid instead.

     select cart.liquid

  5. Add this code to the top of the file:

    {% assign disable_checkout = false %}

    add this code to the top 

  6. Find this line:

    {% for item in cart.items %}

    find this  line 

  7. Copy and paste this code immediately below that line:

    {% if customer.tags contains '!!!!' %}
    {% if item.quantity < #### %}
    {% assign disable_checkout = true %}
    {% endif %}
    {% endif %}

    Note: Replace !!!! with the customer pricing tag that you want to have a minimum quantity. Replace #### with the minimum quantity per product required for the customer to checkout.

    copy and paste this code 

  8. Find the Checkout button, the code will be similar to this:

    {{ 'cart.general.or' | t }} <input type="submit" class="altaltcolour" style="display: inline-block !important; border: 1px grey solid; padding: 10px 15px !important; margin: 10px 0px" id="update-cart" name="checkout" value="{{ 'cart.general.checkout' | t }}" />
    {% if additional_checkout_buttons %}
    <div id="additional-checkout-buttons">
    <span>{{ 'cart.label.other_payment_types' | t }}</span>
    {{ content_for_additional_checkout_buttons }}
    </div>

    find the checkout button 

  9. Copy and paste this code immediately below it:

    {% if customer.tags contains 'Wholesale' %} 
    {% if disable_checkout == true %}
    <p>!!!! customers must purchase #### of each item.</p>
    {% else %}
    
    ****
    
    {% endif %}
    {% endif %} 
    {% else %}
    
    ****
    
    {% endif %} 
    {% endif %}

    Note: Replace “wholesale” with the tag required. Replace !!!! with the customer pricing tag. Replace ### with the minimum cart quantity required to checkout. Cut the theme's checkout button code from step 8 and paste over the ****.

    The final code should look like this:

    {% if customer.tags contains 'Wholesale' %} 
    {% if disable_checkout == true %}
    <p>Wholesale customers must purchase 6 of each item.</p> 
    {% else %}
    {{ 'cart.general.or' | t }} <input type="submit" class="altaltcolour" style="display: 
    inline-block !important; border: 1px grey solid; padding: 10px 15px !important; margin: 
    10px 0px" id="update-cart" name="checkout" value="{{ 'cart.general.checkout' | t }}" />
    
    {% if additional_checkout_buttons %}
    <div id="additional-checkout-buttons">
    <span>{{ 'cart.label.other_payment_types' | t }}</span>
    {{ content_for_additional_checkout_buttons }}
    </div>
    
    {% endif %}
    {% endif %}
    {% else %}
    
    {{ 'cart.general.or' | t }} <input type="submit" class="altaltcolour" style="display: 
    inline-block !important; border: 1px grey solid; padding: 10px 15px !important; margin: 
    10px 0px" id="update-cart" name="checkout" value="{{ 'cart.general.checkout' | t }}" />
    
    {% if additional_checkout_buttons %}
    <div id="additional-checkout-buttons">
    <span>{{ 'cart.label.other_payment_types' | t }}</span>
    {{ content_for_additional_checkout_buttons }}
    </div>
    
    {% endif %} 
    {% endif %}

    final result 

  10. Select Save.

    save 

That's it!