Set a minimum order price

Highlighted
New Member
5 0 0

Hi there,

I'm trying to set a minimum 'checkout' price of $70.

So if somebody tries to checkout with items that sum to less than $70, they should be prevented from checking out.

I'm not entirely sure where to put this code, and how to 'prevent' the checkout; however I understand the basic structure. In pseudocode:

if !(cart.total < 70){

..allow checkout...

} else{

display message

}

 

If I could get some advice on where to throw this code and how to implement it, that would be greatly appreciated.

Thanks

0 Likes
Highlighted
Shopify Staff
Shopify Staff
368 0 39

Hello Graham, Ben here - your Shopify Guru! 

 There is an app that can solve this problem for you called Order Limits (MinMaxify). It lets you set minimum order quantities or cart total and have a bunch of options then just the minimum cart price might be worth looking into. 

I hope this helps! Feel free to reach out if you have any further questions :)

Cheers,
Ben C - Shopify Guru
Support@Shopify.com

0 Likes
Highlighted
Shopify Expert
10007 116 1818

The app Ben mentioned above is a popular option for sure - especially for those that want to avoid having to write any code. It doesn't tend to work well with some themes that have Ajax cart (eg: cart slides in from the side of the page).

Now if you want to try and code something up yourself - that’s cool too! The logic you've posted can be written in Liquid just checking the cart total against a common amount. Something like so:

{% if cart.total_price > 6999 %}
  <!-- Show the checkout buttons (or form) in here. -->
{% else %}
  Uh Oh! You need to spend $70 or more before you can checkout
{% endif %}

If you write something with JavaScript you'd want to grab the cart via ajax and make similar logic calls based on the info you get back.

One thing to note is that with any approach it will still be possible to head to checkout with a product less than the minimum using a cart permalink. Consider all options above deterrents, but just not 100% bulletproof.

★ Winning Partner of the Build a Business competition. ★ http://freakdesign.com.au
2 Likes
Highlighted
New Member
5 0 0

Hi Jason,

I'm new to working with the Shopify code. Where exactly would I put in a code such as that?

I'm also confused as to what you mean by "grab the cart"

 

Thanks 

 

Graham

0 Likes
Highlighted
New Member
1 0 0

I tried to download this app [Order Limits (MinMaxify)] but got the message that this app or plug-in is not compatible with my Shopify account.  I am new to building all a website and an online ordering platform and have a Shopify Lite / Monthly account.  Can you assist please!!??

0 Likes
Highlighted
New Member
2 0 1

Jason, Thanks for this!

 

I have located the "cart.total_price" entry in the cart segment code, (Its currently at line 254 in my theme) but don't know what line / or argument your code needs to be pasted before..

 

I think lots of people would find this supremely helpful (who are either new to shopify / not familiar with the code side.)

Thanks for any help whatsoever! 

 

{% if cart.total_price > 2499 %}
  <!-- Show the checkout buttons (or form) in here. -->
{% else %}
  Uh Oh! You need to spend $25 or more before you can checkout{% endif %}

 

1 Like
Highlighted
Excursionist
44 0 0

Hi dear, check this multi-feature app for managing your minimum order product and price limits. Shopify minimum order amount app facilitates store owner to selling products into maxi and mini orders. The owner can sell products by quantities, product item, and amount. Customers can order into minimum and maximum order limitation. The Shopify maximum order quantity app even & odd series help to selling products in batches. 

 

d74d6ceb22b2eeffbd53cbe9c88be841

305ff4353e00022fc0a83b43ee9f6c61

 

0 Likes
Highlighted
New Member
1 0 1

Taking your example Paul:

 

{% if cart.total_price > 2499 %}
  <!-- Show the checkout buttons (or form) in here. -->
{% else %}
  Uh Oh! You need to spend $25 or more before you can checkout{% endif %}
{% endif %}

I'm using "Supply" theme, so this might be slightly different for your theme.

 

Existing cart.liquid (lines 152-159):

 

          <button type="submit" name="checkout" class="btn">
            <span class="icon icon-cart"></span>
            {{ 'cart.general.checkout' | t }}
          </button>

          {% if additional_checkout_buttons %}
            <div class="additional-checkout-buttons">{{ content_for_additional_checkout_buttons }}</div>
          {% endif %}

Changed to:

 

{% if cart.total_price > 2499 %}
          <button type="submit" name="checkout" class="btn">
            <span class="icon icon-cart"></span>
            {{ 'cart.general.checkout' | t }}
          </button>

          {% if additional_checkout_buttons %}
            <div class="additional-checkout-buttons">{{ content_for_additional_checkout_buttons }}</div>
          {% endif %}
{% else %}
	<p>Uh Oh! You need to spend $25 or more before you can checkout</p>	
{% endif %}

 

 

 

1 Like
Highlighted
New Member
2 0 0

All straight forward and great for a non AJAX cart.

 

Then you get the sneaky customer who can add items in an AJAX cart page until the Checkout Button appears, copy it, then reduce the items so the cart is below the minimum again. Then paste the button into the html themselves.  Its like you have to take control of everything to do with the form so it wont even submit if below the min.  So if you land on the page with more than the min and you reduce it with AJAX it should deactivate the form completely.  It could still be hacked though in the console.

0 Likes
Highlighted
New Member
1 0 0

Hi Matt, 

Just wanted to ask if you know where I should be pasting it exactly as I've tried it but didn't work. I'm using Narrative theme. Thank you.

0 Likes