Set a minimum order price

Graham4
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

Replies 17 (17)
Benjamin_C
Shopify Staff
368 0 42

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

Benjamin | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

Jason
Shopify Expert
10500 178 2108

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.

I jump on these forums to help and share some insights. Not looking to be hired, and not looking for work.
Don't hand out staff invites or give admin password to forum members unless absolutely needed. In most cases the help you need can be handled without that.
★ http://freakdesign.com.au ★
Graham4
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

Mos-Somji
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!!??

Paul_Leon
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 %}

 

HoneyMalk
Explorer
55 0 1

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

 

Matt_Pennington
New Member
1 0 2

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 %}

 

 

 

DGossage
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.

PaulGee4
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.