How can we make sure customers can’t check out until their cart reaches $200? I’m looking for a code to do this without using third-party apps.
Topic summary
Goal: block checkout until the cart total reaches $200, without using third‑party apps.
Proposed approach:
- Use JavaScript (JS) with Shopify Liquid. On the checkout button’s click, read the cart total and conditionally prevent checkout if it’s under $200; otherwise allow checkout.
- Get the cart total in Liquid with: {% assign cart_total = cart.total_price | divided_by: 100 %}. Note: cart.total_price is in cents; dividing by 100 returns the amount in dollars.
Key details:
- JS should intercept the checkout button (e.g., addEventListener) and call event.preventDefault() when below the threshold; optionally show a message to the user.
- Liquid (template) provides the total for use in the front end.
Status: Guidance provided, but no full JS snippet or final implementation details; outcome unresolved. No images or attachments.
This can be achieved using js and liquid code
Write script to get cart total amount when user click on checkout button and check if the amount is less than 200 then prevent the default behavior else allow user to checkout
to get the cart total you can use this code
{% assign cart_total = cart.total_price | divided_by: 100 %}