Crudest way is to only allow checkout through the /cart page and wrap the checkout button in logic checking cart totals.
This also means turning off or hiding accelerated checkout buttons everywhere else like product pages and also on the /cart page.
{%-comment paull.newton+shopifycustomizations@gmail.com %} prices are in pennies optionally place minimum message into a disabled checkout button optional - upsell_product takes a product handle to upsell a specific product with a simple message with link move code for checkout buttons under the else tag {%endcomment%} {% assign checkout_minimum = 10000 %} {% assign upsell_product == "" %} {% if cart.cart-total_price < checkout_minimum %} <p>{%if customer%}customer.first_name{%endif%} add {{ checkout_minimum | minus: cart.cart-total_price | money }} more to your cart</p> {% if upsell_product != blank %} Here's a product you may like {{ all_products[upsell_product].title | link_to: all_products[upsell_product].url,all_products[upsell_product].title }}! {% endif %} {%else %} <! -- checkout button code --> {% endif %}
This is the technical forum there is a forum for questions seeking app solutions: https://community.shopify.com/c/Shopify-Apps/bd-p/shopify-apps
I've trying to do similar logic before checkout, so the checkout button would be disabled/hidden (and a notification message would be displayed) if certain product combination criteria is not met. For instance, something like this:
- quantity of product with SKU xxx needs to be at least n
- products with SKU yyy (add-on) cannot be in cart without product with SKU xxx (main product)
Is your code example supposed to be injected into cart-template.liquid? If so, what I've observed that if the user is changing the quantities when still on the cart page, the {{ cart.items }} are not changing on the fly, so any if-else-logic based on that solely with liquid is not adequate. Is there way to achieve this?
User | Count |
---|---|
23 | |
19 | |
18 | |
17 | |
16 |