About Custom Code Rules
S
Written by Support
Updated over a week ago

WARNING: knowledge of javascript is required. It's possible to inject arbitrary code using this method, so be careful

Sometimes merchants want to create offer conditions (rules) that can't be built with our point and click rule builder. There's a way around this! It requires some knowledge of javascript.

First, go to the shop's setting page and enable custom code rules:

Then you can go to the offer and a new rule type "Custom Code Is True" will be available. The "raw_cart" object, a JS representation of the shopping cart, is available here. Inspect the cart (or anything else about the window/shopper/session) in any way you want, and if your code returns TRUE, the rule will be satisfied.

For example:

Did this answer your question?