Set a minimum and maximum order value in cart

Set a minimum and maximum order value in cart

liambeauchamp
Excursionist
38 2 6

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 6 (6)

Liquid_xPert_SJ
Shopify Partner
1175 130 167

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

- If you need any technical assistance, feel free to send me a DM. You no longer have to search for answers without getting a response.
- 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 🙂- If you need any technical assistance, feel free to send me a DM. You no longer have to search for answers without getting a response.
- 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
38 2 6

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

Liquid_xPert_SJ
Shopify Partner
1175 130 167

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

 

thanks

- If you need any technical assistance, feel free to send me a DM. You no longer have to search for answers without getting a response.
- 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 🙂- If you need any technical assistance, feel free to send me a DM. You no longer have to search for answers without getting a response.
- 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
38 2 6

Apologies @Liquid_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! 

 

NickRE8
Excursionist
14 2 2

This works great @Liquid_xPert_SJ , but is there a way to still show the items in the cart, right now it hides everything until you get over $500.00:

image.png

 

 

image (1).png

E-Commerce & Digital Content Team : www.RESHOEVN8R.com

KarmaChime
Excursionist
50 2 0

You can set a minimum and maximum order value in the cart using the PayRules: Hide Payment Methods app to manage payment methods based on order value. Here's how you can do it:

 

  1. Add all the payment methods you want to restrict until the minimum order value is reached from the "Select payment methods" & “Additional payment methods” fields.
  2. In the "Cart subtotal" section, set the minimum limit to 15 and set the maximum limit to 500 for an example.

order-value.png

 

This setup will ensure that the checkout button is only active within the specified order value range.