Dynamic Customization Options
This guide will help developers build rules for dynamic features. Dynamic features enable a merchant to create a library of rules that conditionally populate information while the shopper checks out.
Supported Features
Conditions Logic
Conditions drive the logic of rules and are checked when a Shopper interacts with Bolt Checkout. You can add multiple conditions together using &&
to create complex rules. Reference the Rules Engine for a list of all possible operators.
Multi-Condition Example
ShippingAddress.Locality == "City" &&
ShippingAddress.Region == "California" &&
ShippingAddress.PostalCode == "94103" &&
ShippingAddress.CountryCode == "US" &&
ShippingAddress.Country == "United States"
Available Conditions
Condition | Expression Example | Notes |
---|---|---|
Check Address Verification | GetAddressType() == |
if Address Verification Feature set to none, options include: standard & po_box. if Address Verification Feature set to lob, options include: standard,po_box, & military. |
Check All Cart Items in List | If all(Items, {.Reference in [“11”,“13”]}) | |
Check All Cart Items in List | If all(Items, {.SKU in [“sku1”,“sku2”]}) | |
Check Cart Discounts | If len(Discounts)==0 | |
Check Cart is Missing Specific Item | If all(Items, {.Reference != “15”}) | |
Check Currency | If Cart.Currency==‘USD’ | |
Check Discount Total | If Cart.DiscountTotal==300 | |
Check if Cart has Non-Taxable Item | If any(Items, {!.Taxable}) | |
Check if Cart Item Exceeds Taxable Limit | If any(Items, {.TaxAmount>5}) | |
Check if Cart Items Total Matches | If Cart.ItemTotal==800 | |
Check Shipping Carrier | If Shipment.Carrier==“Fedex” | |
Check Shipping Cost | If Shipment.Cost==120 | |
Check Shipping Country | If ShippingAddress.Country == “United States” | |
Check Shipping Country Code | If ShippingAddress.CountryCode == “US” | |
Check Shipping Locality | If ShippingAddress.Locality == “City” && ShippingAddress.Region == “California” | |
Check Shipping Postal Code | If ShippingAddress.PostalCode == “94103” | |
Check Shipping Reference | If Shipment.Reference==“jkl123” | |
Check Shipping Service | If Shipment.Service==“Ground” | |
Check Shipping Total | If Cart.ShippingTotal==120+12 | |
Check Tax Amount | If Cart.TaxAmount==0 | |
Check Tax Amount | If Shipment.TaxAmount>0 | |
Check Total Amount | If Cart.TotalAmount==200 | |
Check All Product Names Containing Prefix | If all(Items, {.Name startsWith “Test”}) | |
Check All Product Names Containing String | If all(Items, {.Name contains “product”}) | |
Check All Product Names Containing Suffix | If any(Items, {.Name endsWith “1”}) | |
Check All Product Names Matching Regular Expression | If all(Items, {.Name matches “^Test.+"}) |
Commands
You can execute a command when a condition is met. There are two main commands you can use with Bolt:
- Display Notices:
Message => "Delivery to this region is currently unavailable."
- Display Checkbox:
checkbox => confirm_21
- Convert $€¥ to Integer:
toMonetary(<NUMBER>); toMonetary(10.12) == 1012
- Round to Ceiling:
ceil(<INT>); You are $%ceil(toMonetary(150) - Cart.TotalAmount)% away from free shipping
Integration Examples
Example One
Expression:
any(Items, {.SKU in ["MATTRESS01-C","MATTRESS01", "MBASE05"]})
Command:
Message => "Mattresses and Comfort Bases only ship to US addresses. PO boxes and APO/FPO addresses cannot be accommodated at this time."
Example Two
Expression:
Cart.TotalAmount-Cart.ShippingTotal<5000 &&
ShippingAddress.CountryCode == "US" && (ShippingAddress.Region not in
["Alaska","Guam","Hawaii","Puerto Rico"])
Command:
Message => "Just add $%5000-(Cart.TotalAmount-Cart.ShippingTotal)% to get FREE U.S. Shipping! Continue Shopping."
Example Three
Expression:
ShippingAddress.Region in ['Alaska','Hawaii']
Command:
Message => "AK and HI CoolBot product orders will ship by United States Postal Service. Please email email@email.com for an A/C shipping quote."