
This JavaScript code creates a smart cart restriction system for Shopify stores that enforces a minimum order value ($150) when certain specified products are in the cart. Here’s a complete explanation of how it works and how to implement it.
What This Script Does
Product Specific Minimum Order: When any of the specified products are in the cart, the customer must meet a $150 minimum order to checkout.
Automatic Detection: The script automatically detects when restricted products are added to cart.
Visual Feedback:
Disables checkout buttons when conditions aren’t met
Shows clear error messages
Works on both cart page and mini-cart/drawer
Real-time Updates: Responds immediately when cart contents change
📍 Where to Add This Code?
Go to Shopify Admin → Online Store → Themes → Edit Code → theme.liquid
Paste this entire script just before the closing </body>
 tag.
⚙️ Customization Needed
ReplaceÂ
specialProductIds
 with your actual Shopify product IDs.ChangeÂ
minAmount
 if you want a different minimum (value is in cents, soÂ15000 = $150
).
Want to increase order values in your Shopify store? This custom script enforces a minimum order amount ($150 or more) when specific products are in the cart. It automatically blocks checkout if the condition isn’t met and shows a clear error message, encouraging customers to add more items.
The system works invisibly in the background until needed, then provides crystal-clear guidance to shoppers. Unlike app solutions, it won’t slow down your store or create subscription fees. The customizable error message lets you maintain brand voice while enforcing policies. For seasonal campaigns, simply adjust the minimum amount or product list as needed.
🚀 Key Benefits
✔ No expensive apps needed – Lightweight code solution
✔ Works on cart page + mini-cart drawer
✔ Real-time validation – Updates instantly when cart changes
✔ Customizable – Set your own product IDs and minimum amount