How to set up Minimum Order Amount in the liquid file: cart-template.liquid?

Hi,

I want to set up a minimum order amount before anyone can place an order.

For example, no one should be able to pay if the order amount is less than £40.

Is there any sample code to do this.

I have heard you can add a code in cart-template.liquid .

Is there any sample code available?

Thanks,

Hey @paulson1 ,

To set a minimum order amount in your Shopify store, you can indeed modify the cart-template.liquid file. Here’s a sample code snippet that checks the cart’s total value and prevents the user from checking out if it’s below £40.

Follow these steps:

  1. Online Store > Theme > Edit Code

  2. Open cart-template.liquid (this file may also be named cart.liquid depending on your theme).

  3. Add The following code before the checkout button:

{% assign min_order_amount = 40 %}
{% if cart.total_price < min_order_amount * 100 %}
  

Your current order total is below the minimum required amount of £40. Please add more items to your cart.

  
{% endif %}

If I was able to help you, please don’t forget to Like and mark it as the Solution!

Best Regard,

Rajat Sharma

Hi, you can find snippet (modified example):


where min is the minimum and max is the maximum. I use the product/variant meta field as a reference for the value. Look for the tag quantity-selector. If you still need help, let me know. I also need to know what theme you use.

@paulson1 ,

Thank you for your response! I’m glad to hear the solution worked well for you. If you need any further assistance, please don’t hesitate to reach out.

Hi,

I could not find the file cart-template.liquid. There is one called main-cart.liquid.

I am using the theme - https://themes.shopify.com/themes/canopy/styles/natural

Hope the file I need to edit is main-cart.liquid

Thanks