Shopify themes, liquid, logos, and UX
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,
Solved! Go to the solution
This is an accepted solution.
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 %}
<p style="color: red;">Your current order total is below the minimum required amount of £40. Please add more items to your cart.</p>
<style>
.btn--checkout {
display: none;
}
</style>
{% endif %}
If I was able to help you, please don't forget to Like and mark it as the Solution!
Best Regard,
Rajat Sharma
This is an accepted solution.
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 %}
<p style="color: red;">Your current order total is below the minimum required amount of £40. Please add more items to your cart.</p>
<style>
.btn--checkout {
display: none;
}
</style>
{% endif %}
If I was able to help you, please don't forget to Like and mark it as the Solution!
Best Regard,
Rajat Sharma
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, you can find snippet (modified example):
<input
data-name="quantity-selector-pro-input-cart"
class="quantity-selector__input {% if size == 'sm' %}text-sm{% endif %}"
type="number"
is="quantity-input"
value="{{ line_item.quantity }}"
{% if add_updates %}
name="updates[]"
{% endif %}
inputmode="numeric"
step="{{ variant.quantity_rule.increment }}"
min="{{ pro_prod_min_quant_cart }}"
{% if max_quantity != blank %}
max="{{ max_quantity | at_least: line_item.quantity }}"
{% endif %}
data-line-key="{{ line_item.key }}"
aria-label="{{ 'product.quantity.change_quantity' | t | escape }}">
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.
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
Hey Community 👋 Did you know that March 15th is National Everything You Think Is W...
By JasonH Apr 1, 2025Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025