Support Center

Javascript Snippet: Define a minimum or maximum Subtotal for your Orders

Use Javascript Responsibly: Other apps and theme elements may contain Javascript code that might interfere with yours. If you are not sure about the effects of this code contact a professional.

This is a Javascript and Liquid based code to require a minumum or maximum subtotal on Checkout. Needs one part in theme options and include in liquid code.

1- Add this code to your Theme Options file called options.json in the Theme Code Editor section Config (Theme options).

  "Define minimum or maximum purchase": {
    "icon": "shopping-cart",
    "options": {
      "define_purchase": {
        "name": "Activate Rule",
        "type": "checkbox",
        "default": "0"
      },
      "define_purchase_option": {
        "name": "Order subtotal should be:",
        "type": "select",
        "default": "",
        "options": [
          {
            "Greater than": "greater_than"
          },
          {
            "Smaller than": "smaller_than"
          }
        ]
      },
      "define_purchase_amount": {
        "name": "Set amount Without points and currency code",
        "type": "input",
        "default": ""
      },
      "define_purchase_message": {
        "name": "Message if the rule is true:",
        "type": "text",
        "default": ""
      }
    }
  }

2- In the Theme Code Editor, create a partial called min_max_amount.liquid and copy and paste the code below.

gistMarkdown.js

3- Copy and paste this include in cart and checkout layouts {% include 'min_max_amount' %}

Start your journey with us!

Free trial for 14 days. No credit card required.