I want to add minimum cart value to checkout in shopify studio theme.

Leenu1994
Tourist
11 0 2

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

Replies 11 (11)

techlyser_web
Shopify Partner
1423 268 282

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.

Techlyser || Shopify Partner || Helping eCommerce Stores
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution.
- For further discussion contact: Email ID- info@techlyser.com
Leenu1994
Tourist
11 0 2

Which are the files needs to be edited for studio theme? I tried in main.cart.footer.liquid file. It's not working.

techlyser_web
Shopify Partner
1423 268 282

hello @Leenu1994 
we can manage javascript code from either theme.liquid or theme.js file of theme.

Techlyser || Shopify Partner || Helping eCommerce Stores
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution.
- For further discussion contact: Email ID- info@techlyser.com

okur90
Shopify Partner
126 20 17

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.

Code Slingin, Pixel Wranglin - Laugh it up at onlinex.com.au
Leenu1994
Tourist
11 0 2

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?

techlyser_web
Shopify Partner
1423 268 282

Hello @Leenu1994 
thats why i suggest to code via javascript so it works on realtime you increase or decrease cart values.

Techlyser || Shopify Partner || Helping eCommerce Stores
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution.
- For further discussion contact: Email ID- info@techlyser.com
Leenu1994
Tourist
11 0 2

Ok. If you don't mind, can you please just go through my coding and check what can be done ,? 

 

TIA

techlyser_web
Shopify Partner
1423 268 282

Hello @Leenu1994 
it needs to access for store then i can see and update code for you.

Techlyser || Shopify Partner || Helping eCommerce Stores
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution.
- For further discussion contact: Email ID- info@techlyser.com
Leenu1994
Tourist
11 0 2

Can you send me a collaborator request?

johngabat
Visitor
1 0 0

Would you also be able to help us with this? 

 

supernovastore
Visitor
2 0 1

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