Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hi team,
I want to add minimum cart value to checkout in shopify studio theme. I tried some coding but nothing works.
Can anybody help me?
TIA
Hello @Leenu1994
we can do this way to make Checkout button disable via javascript until minimum cart value reached and it needs some cod_e on theme.
Which are the files needs to be edited for studio theme? I tried in main.cart.footer.liquid file. It's not working.
hello @Leenu1994
we can manage javascript code from either theme.liquid or theme.js file of theme.
Hi @Leenu1994
In the theme code editor, look for the `cart-template.liquid` file in the "Sections" folder and find the code where the cart total is calculated. It should look something like this:
{% assign cart_total_price = cart.total_price %}
Just below that line, add the following code to set your minimum cart value requirement:
{% assign minimum_cart_value = 5000 %} {# Set the minimum cart value in cents #}
Replace `5000` with your desired minimum cart value in cents. For example, if you want a minimum cart value of $50, use `5000`.
find the code for the "Checkout" button in the `cart-template.liquid` file. It should look like this:
<button type="submit" name="checkout" class="cart__submit btn">
{{ 'cart.general.checkout' | t }}
</button>
Replace the "Checkout" button code with the following code to disable the button if the cart total is less than the minimum value:
{% if cart_total_price >= minimum_cart_value %}
<button type="submit" name="checkout" class="cart__submit btn">
{{ 'cart.general.checkout' | t }}
</button>
{% else %}
<button type="button" disabled class="cart__submit btn" title="{{ 'Your custom message here' }}">
{{ 'cart.general.checkout' | t }}
</button>
<p class="cart__minimum-warning">Minimum cart value required for checkout is ${{ minimum_cart_value | money_without_currency }}.</p>
{% endif %}
You can also style the warning message by adding the following CSS to your theme's CSS file:
.cart__minimum-warning {
color: red;
font-weight: bold;
margin-top: 10px;
}
Keep me updated on your progress, and don't hesitate to ask if you need any assistance.
Hello,
Thanks for your message. It didn't work out. I do it another way to make it work. But now the issue is checkout button disable/enable for less than min cart value works only if I refresh the page.
Do you have any solution for the same?
Hello @Leenu1994
thats why i suggest to code via javascript so it works on realtime you increase or decrease cart values.
Ok. If you don't mind, can you please just go through my coding and check what can be done ,?
TIA
Hello @Leenu1994
it needs to access for store then i can see and update code for you.
Can you send me a collaborator request?
Would you also be able to help us with this?
As of September 2023 'cart-template.liquid' does not come up when searched. When finding similar codes and following instructions, the end result has a grey box in cart instead of Submit button which says "translation missing: en.cart.general.checkout" and will not allow you to Submit below, or above, the set minimum order value.
Is there anyway you could re-check how to do this? I have looked everywhere in the forums and youtube and can't find a working solution to set a minimum order value. Thank you for your time. ~Lauren
Discover how to increase customer engagement on your store with articles from Shopify A...
By Jacqui Apr 23, 2025Hey 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, 2025