Have your say in Community Polls: What was/is your greatest motivation to start your own business?

How can I set a minimum order amount on my website?

How can I set a minimum order amount on my website?

stinem123
Trailblazer
166 0 30

Hello Everyone, 

How can I setup a minimum order amount to DKK 149/-

I dont want any order below DKK. 149/-

Kindly guide me a code or something to do it (I prefer not using a app)

I am using Stiletto theme

Website is www.melchiorjewelry.com 

 

If possible I would like to add a custom message if the order is below 140DKK.

Thanks a lot

 

 

 

 

 

 

 

@StoreWatchers 

Reply 1 (1)

alicerichard65
Visitor
1 0 0

@stinem123 wrote:

Hello Everyone, 

How can I setup a minimum order amount to DKK 149/-

I dont want any order below DKK. 149/-

Kindly guide me a code or something to do it (I prefer not using a app)

I am using Stiletto theme

Website is www.melchiorjewelry.com 

 

If possible I would like to add a custom message if the order is below 140DKK.

Thanks a lot

More Information

 

@StoreWatchers 


To set a minimum order amount of DKK 149 on your Shopify store:

1. Add Minimum Order Check (JavaScript):

  1. Go to Online Store > Themes > Actions > Edit code.
  2. Open theme.js or global.js under Assets.
  3. Add this code:

         document.addEventListener("DOMContentLoaded", function() {
const minOrderAmount = 149;
const cartTotal = Shopify.checkout ? Shopify.checkout.total_price / 100 : 0;

if (cartTotal < minOrderAmount) {
alert(`Minimum order is DKK 149. Your order is DKK ${cartTotal.toFixed(2)}`);
const checkoutButton = document.querySelector('[name="checkout"]');
if (checkoutButton) checkoutButton.disabled = true;
}
});

 

2. Display Message on Cart Page:

  1. Go to Sections > cart.liquid.
  2. Add this below the cart total:

          {% if cart.total_price < 14900 %}
<div class="alert alert-warning">Your order is below DKK 149. Please add more items.</div>
{% endif %}

 

This will alert users and display a message if their cart total is below DKK 149.

Best regards,
Diana Peters