Set a minimum and maximum order value in cart

liambeauchamp
Excursionist
25 2 5

Hello!

 

I am building an ecommerce bakery website using the Taste Theme and I want to set a cart total minimum order value of £15 which means the 'Checkout' button is greyed out until a person has added £15 worth of product to their cart. 

 

I also want to set a maximum order value as I am a small-batch baker so want people to message me before placing large orders. I know there are apps available, but I am trying to keep running costs to a minimum, so is it possible to do in the code? 

 

Here is the link to my website: https://batchedcookies.co.uk/

 

Any advice that can be provided will be greatly received! 

Replies 5 (5)

Liqiud_xPert_SJ
Shopify Partner
730 93 115

Hi@liambeauchamp for the minimum cart value please refer to the below code also can you please confirm what is the minimum order limit?

 

{% assign _pVal = cart.total_price | divided_by : 100 %}
   {% if _pVal > 10 %}
// Put all your checkout code here
   {% else %}
      <div style="border:solid 2px red;">Order must be greater than 100 </div>
   {% endif %}

 

Code:

gr_trading_0-1696779678407.png

 

if you are not familiar with coding do let me know i can help you.

thanks

- Please don't forget to Like and Mark Solution to the post that helped you. Thanks!
- Your Shopify Solution Specialist For further discussion contact: Email ID- Liqud_3xPert_SJ OR Whatsapp
- Buy a Coffee for me to get more frequently help 🙂
- Hire Me to unlock the full potential of your e-commerce store Now 🙂
liambeauchamp
Excursionist
25 2 5

Thank you @Liqiud_xPert_SJ. The minimum order value is £15 and yes, I am familiar with coding so will try adding this in

Liqiud_xPert_SJ
Shopify Partner
730 93 115

thats good then you can use the same code above and change the price according to your  need and it will work.

 

thanks

- Please don't forget to Like and Mark Solution to the post that helped you. Thanks!
- Your Shopify Solution Specialist For further discussion contact: Email ID- Liqud_3xPert_SJ OR Whatsapp
- Buy a Coffee for me to get more frequently help 🙂
- Hire Me to unlock the full potential of your e-commerce store Now 🙂
liambeauchamp
Excursionist
25 2 5

Apologies @Liqiud_xPert_SJ - that didn't quite work although that is more likely because of my coding. If you can talk me through the coding process and just confirm what I need to add and where, that would be greatly appreciated! 

 

ArrayArtisan
Tourist
50 0 2

To set a minimum and maximum order value on your ecommerce bakery website, such as requiring a minimum of £15 in the cart before allowing checkout and setting a maximum order value to encourage direct contact for large orders, you can use the KlinKode PayRules app. This app enables you to implement rules that restrict checkout based on the cart's total value, effectively managing both minimum and maximum limits without the need for custom coding.

 

For implementing these rules on your site, visit the app here: https://apps.shopify.com/klinkode-payrules

 

- Control payment methods visibility at checkout by KlinKode PayRules app.
- You can join in our Facebook group for Shopify help.