Create your own ecommerce website and start selling successfully with ShopWired today

Create your ecommerce website on ShopWired today.
Start today with 14 days free

Create your own ecommerce website and start selling successfully with ShopWired today

Create your ecommerce website on ShopWired today.
Start today with 14 days free

Setting a minimum order value

Theme Customisations - Coding
5th February 2021

Before you proceed:
The following article contains information that requires you to have some prior knowledge about coding in order to correctly implement the proposed change to your theme. If done incorrectly alterations made to your theme’s code can negatively impact your website causing visual and performance issues. Therefore, we strongly recommend that you only undertake this effort if you are completely confident that you know what you’re doing. If you have no coding experience at all, aren’t entirely comfortable following the instructions in this article or if you simply don’t understand the instructions then we recommend you instead contact our partners, Coding Masters, who will complete the work for you for a set fee.


There maybe times that you want to set a minimum order value on your website.

This can be achieved by requiring that one of the checkout totals (e.g. the product total cost, or the grand total of the order (including delivery) is greater than the minimum order value you set.

On the checkout_basket view at the top of the content set a new variable, e.g.

{% set minimum_order_value = 25.00 %}

You can change 25.00 to whatever minimum order value you want to enforce.

Locate the buttons that enable the user to submit the basket form - these will usually be towards the very bottom of the page file.

The code to display the buttons will depend on the theme you are using.

The buttons need to be surrounded with an if statement to test whether or not the value of the order is greater than your minimum order value, e.g.

{{ html.button('', '', 'Proceed To Checkout', 'expanded button') }}
{% if basket.paypal_express_enabled %}
        {{ html.button('paypal_express', '1', 'PayPal Express', 'expanded button') }}
{% endif %}

becomes...

{% if basket.total > minimum_order_value %}
       {{ html.button('', '', 'Proceed To Checkout', 'expanded button') }}
       {% if basket.paypal_express_enabled %}
              {{ html.button('paypal_express', '1', 'PayPal Express', 'expanded button') }}
       {% endif %}
{% else %}
       You will need to order a minimum of {{ minimum_order_value }} in order to proceed to checkout
{% endif %}

The exact variable to use in the test, e.g. basket.total will depend on whether you want to include the delivery cost when deciding whether a user has met the minimum order charge. You can view the available basket variables here.

Please note that the above example does not include the necessary Javascript that would be needed to determine if a delivery rate is chosen that means the customer's order is over the minimum order value.