[{"data":1,"prerenderedAt":477},["ShallowReactive",2],{"bootstrap":3,"blog-the-new-promotion-rule-engine-changes-the-game-for-how-to-do-promotions":277},{"navigation":4,"globalConfig":196,"forms":218},{"headerSections":5,"headerFooterLinks":67,"footer":76,"legalLinks":153,"socialLinks":176},[6,39,44,50,57,62],{"hasSubMenu":7,"title":8,"links":9,"columns":38},true,"Product",[10,20,26,32],{"showTag":11,"_modelApiKey":12,"text":13,"subtitle":14,"icon":15,"isExternal":11,"link":16,"openForm":11},false,"navigation_link","Universal checkout","Sell anywhere","globe-simple",{"_modelApiKey":17,"slug":18,"title":19},"page","universal-checkout","Universal Checkout",{"showTag":11,"_modelApiKey":12,"text":21,"subtitle":22,"icon":23,"isExternal":11,"link":24,"openForm":11},"Distributed OMS","Manage orders","package",{"_modelApiKey":17,"slug":25,"title":21},"distributed-oms",{"showTag":11,"_modelApiKey":12,"text":27,"subtitle":28,"icon":29,"isExternal":11,"link":30,"openForm":11},"Promotion engine","Automated discounts","seal-percent",{"_modelApiKey":17,"slug":31,"title":27},"promotion-engine",{"showTag":11,"_modelApiKey":12,"text":33,"subtitle":34,"icon":35,"isExternal":11,"link":36,"openForm":11},"POS system","Operate stores","devices",{"_modelApiKey":17,"slug":37,"title":33},"pos-system",2,{"hasSubMenu":11,"showTag":11,"_modelApiKey":12,"text":40,"isExternal":11,"link":41,"openForm":11,"title":40},"Pricing",{"_modelApiKey":42,"slug":43},"pricing_page","pricing",{"hasSubMenu":11,"showTag":11,"_modelApiKey":12,"text":45,"isExternal":11,"link":46,"openForm":11,"title":45},"Customers",{"_modelApiKey":47,"slug":48,"title":49},"customer_landing_page","customers","Customers page",{"hasSubMenu":11,"showTag":11,"_modelApiKey":12,"text":51,"isExternal":11,"link":52,"openForm":11,"form":54,"title":51},"Partners",{"_modelApiKey":17,"slug":53,"title":51},"partners",{"_modelApiKey":55,"slug":53,"name":56},"form","PartnersForm",{"hasSubMenu":11,"showTag":11,"_modelApiKey":12,"text":58,"label":59,"isExternal":7,"url":60,"openForm":11,"title":61},"Docs Hub","Learn more","https:\u002F\u002Fdocs.commercelayer.io\u002F","Docs",{"hasSubMenu":11,"showTag":11,"_modelApiKey":12,"text":63,"isExternal":11,"link":64,"openForm":11,"title":63},"Blog",{"_modelApiKey":65,"slug":66},"blog_landing_page","blog",[68,72],{"text":69,"link":70},"Sign in",{"_modelApiKey":12,"text":69,"isExternal":7,"url":71,"openForm":11},"https:\u002F\u002Fdashboard.commercelayer.io\u002Fsign_in",{"text":73,"link":74},"Sign up for free",{"_modelApiKey":12,"text":73,"isExternal":7,"url":75,"openForm":11},"https:\u002F\u002Fdashboard.commercelayer.io\u002Fsign_up",[77,89,109,132],{"hasSubMenu":7,"title":8,"links":78},[79,81,83,85,87],{"showTag":11,"_modelApiKey":12,"text":13,"subtitle":14,"icon":15,"isExternal":11,"link":80,"openForm":11},{"_modelApiKey":17,"slug":18,"title":19},{"showTag":11,"_modelApiKey":12,"text":21,"subtitle":22,"icon":23,"isExternal":11,"link":82,"openForm":11},{"_modelApiKey":17,"slug":25,"title":21},{"showTag":11,"_modelApiKey":12,"text":27,"subtitle":28,"icon":29,"isExternal":11,"link":84,"openForm":11},{"_modelApiKey":17,"slug":31,"title":27},{"showTag":11,"_modelApiKey":12,"text":33,"subtitle":34,"icon":35,"isExternal":11,"link":86,"openForm":11},{"_modelApiKey":17,"slug":37,"title":33},{"showTag":11,"_modelApiKey":12,"text":40,"isExternal":11,"link":88,"openForm":11},{"_modelApiKey":42,"slug":43},{"hasSubMenu":7,"title":90,"links":91},"Resources",[92,94,99,104,107],{"showTag":11,"_modelApiKey":12,"text":93,"isExternal":7,"url":60,"openForm":11},"Documentation",{"showTag":11,"_modelApiKey":12,"text":95,"label":95,"isExternal":11,"link":96,"openForm":11},"Agentic Commerce",{"_modelApiKey":17,"slug":97,"title":98},"agentic-commerce-whitepaper","Agentic Commerce Whitepaper",{"showTag":11,"_modelApiKey":12,"text":100,"isExternal":11,"link":101,"openForm":11},"Core concepts",{"_modelApiKey":17,"slug":102,"title":103},"headless-commerce","Headless commerce",{"showTag":11,"_modelApiKey":12,"text":105,"isExternal":7,"url":106,"openForm":11},"Changelog","https:\u002F\u002Fdocs.commercelayer.io\u002Fchangelog\u002F",{"showTag":11,"_modelApiKey":12,"text":63,"isExternal":11,"link":108,"openForm":11},{"_modelApiKey":65,"slug":66},{"hasSubMenu":7,"title":110,"links":111},"Company",[112,116,118,121,126],{"showTag":11,"_modelApiKey":12,"text":113,"isExternal":11,"link":114,"openForm":11},"Vision",{"_modelApiKey":17,"slug":115,"title":113},"vision",{"showTag":11,"_modelApiKey":12,"text":45,"isExternal":11,"link":117,"openForm":11},{"_modelApiKey":47,"slug":48,"title":49},{"showTag":11,"_modelApiKey":12,"text":51,"isExternal":11,"link":119,"openForm":11,"form":120},{"_modelApiKey":17,"slug":53,"title":51},{"_modelApiKey":55,"slug":53,"name":56},{"showTag":11,"_modelApiKey":12,"text":122,"isExternal":11,"link":123,"openForm":11},"Security",{"_modelApiKey":17,"slug":124,"title":125},"security","Security at Commerce Layer",{"showTag":11,"_modelApiKey":12,"text":127,"label":128,"isExternal":11,"openForm":7,"form":129},"Giveback","Giveback program",{"_modelApiKey":55,"slug":130,"name":131},"giveback","GivebackForm",{"hasSubMenu":7,"title":133,"links":134},"Get in touch",[135,140,145,149],{"showTag":11,"_modelApiKey":12,"text":136,"isExternal":11,"openForm":7,"form":137},"Contact",{"_modelApiKey":55,"slug":138,"name":139},"contact","ContactUsForm",{"showTag":11,"_modelApiKey":12,"text":141,"isExternal":11,"openForm":7,"form":142},"Book a demo",{"_modelApiKey":55,"slug":143,"name":144},"demo","RequestDemoForm",{"showTag":11,"_modelApiKey":12,"text":146,"label":147,"isExternal":7,"url":148,"openForm":11},"Support","Email support","mailto:support@commercelayer.io",{"showTag":11,"_modelApiKey":12,"text":150,"label":151,"isExternal":7,"url":152,"openForm":11},"Community","Discord community","https:\u002F\u002Fdiscord.gg\u002Fcommercelayer",{"hasSubMenu":7,"title":154,"links":155},"Legal",[156,161,165,169,173],{"showTag":11,"_modelApiKey":12,"text":157,"label":158,"isExternal":7,"url":159,"openForm":11,"htmlClassNames":160},"Terms","Terms and conditions","\u002Flegal-embed\u002Fterms-of-service","iubenda-nostyle no-brand iubenda-noiframe iubenda-embed",{"showTag":11,"_modelApiKey":12,"text":162,"label":163,"isExternal":7,"url":164,"openForm":11,"htmlClassNames":160},"Privacy","Privacy policy","\u002Flegal-embed\u002Fprivacy-policy",{"showTag":11,"_modelApiKey":12,"text":166,"label":167,"isExternal":7,"url":168,"openForm":11,"htmlClassNames":160},"Cookies","Cookie policy","\u002Flegal-embed\u002Fcookie-policy",{"showTag":11,"_modelApiKey":12,"text":170,"isExternal":7,"url":171,"openForm":11,"htmlClassNames":172},"Notice at collection","#","iubenda-cs-uspr-link",{"showTag":11,"_modelApiKey":12,"text":174,"isExternal":7,"url":171,"openForm":11,"htmlClassNames":175},"Privacy preferences","iubenda-cs-preferences-link",[177,180,184,188,192],{"title":178,"type":179,"url":152,"isExternal":7},"Discord","discord-logo",{"title":181,"type":182,"url":183,"isExternal":7},"Github","github","https:\u002F\u002Fgithub.com\u002Fcommercelayer",{"title":185,"type":186,"url":187,"isExternal":7},"Bluesky","bluesky-logo","https:\u002F\u002Fbsky.app\u002Fprofile\u002Fcommercelayer.io",{"title":189,"type":190,"url":191,"isExternal":7},"X","x-logo","https:\u002F\u002Fx.com\u002Fcommercelayer",{"title":193,"type":194,"url":195,"isExternal":7},"LinkedIn","linkedin","https:\u002F\u002Fwww.linkedin.com\u002Fcompany\u002Fcommerce-layer",{"pagesWithoutCtaPanel":197,"ctaPanel":198,"notification":208,"showApiResponseTime":11,"newsletterSignup":216},[],{"title":199,"subtitle":200,"ctas":201},"Ready to get started?","Discover how we can help your business.",[202,205],{"_modelApiKey":203,"text":204,"isExternal":7,"url":75,"openForm":11},"link","Get started for free",{"_modelApiKey":203,"text":206,"isExternal":11,"openForm":7,"form":207},"Contact us",{"_modelApiKey":55,"slug":138,"name":139},{"showNotification":7,"link":209,"linkText":210,"text":215},{"_modelApiKey":203,"text":210,"isExternal":11,"link":211,"openForm":11},"Read article",{"_modelApiKey":212,"slug":213,"title":214},"blog_post","payment-api-redesigned","Introducing our new Payments API. For humans and agents.","\u003Cp>Introducing our new Payments API. For humans and agents.\u003C\u002Fp>\n",{"ctaText":217},"Subscribe",[219,225,229,236,240,246,249,253,261,262,267,272,274],{"_modelApiKey":55,"slug":220,"pardotFormEmbedCode":221,"formEmbedMinHeight":222,"successTitle":223,"successCopy":224},"agentic-commerce","https:\u002F\u002Fcommercelayer.fillout.com\u002Ft\u002F5w4Khwgxr6us?whitepaper=agentic",520,"Thank you for your request!","We’ll be in touch soon to arrange a date and time for your personalized demo.",{"_modelApiKey":55,"slug":226,"pardotFormEmbedCode":227,"formEmbedMinHeight":228,"successTitle":223,"successCopy":224},"shopify","https:\u002F\u002Fform.fillout.com\u002Ft\u002FgVnLSmKZwRus",850,{"_modelApiKey":55,"slug":130,"pardotFormEmbedCode":230,"formEmbedMinHeight":231,"displayTitle":232,"copy":233,"successTitle":234,"successCopy":235},"https:\u002F\u002Fform.fillout.com\u002Ft\u002FmVDF8aAiofus",500,"We give back.","\u003Cp>Part of Commerce Layer&#39;s company ethos is to empathize and support one another: co-workers, customers, and community. We want to do our part to help nonprofit organizations and small businesses who may feel adversely affected by the current global economic climate, and as a result, need in-kind support to reach their customers.\u003C\u002Fp>\n\n\u003Cp>If this general description matches your organization’s needs, please tell us your story by completing the following form so we can consider helping your cause.\u003C\u002Fp>\n","Thank you!","We will contact you soon to learn more about your story.",{"_modelApiKey":55,"slug":237,"pardotFormEmbedCode":227,"formEmbedMinHeight":228,"displayTitle":238,"copy":239},"book-an-onboarding-session","Book an onboarding session","\u003Cp>Schedule some time and our devs will help you set up a Commerce Layer + Sanity store.\u003C\u002Fp>\n",{"_modelApiKey":55,"slug":241,"pardotFormEmbedCode":242,"formEmbedMinHeight":243,"displayTitle":244,"successTitle":234,"successCopy":245},"download-our-whitepaper","https:\u002F\u002Fform.fillout.com\u002Ft\u002F5YPWmy8oT7us?whitepaper=ComposableCommerce",450,"Download our whitepaper.","Check your inbox. You should receive a download link soon.",{"_modelApiKey":55,"slug":247,"pardotFormEmbedCode":248,"formEmbedMinHeight":243,"displayTitle":244,"successTitle":234,"successCopy":245},"download-the-content-and-commerce-whitepaper","https:\u002F\u002Fform.fillout.com\u002Ft\u002F5YPWmy8oT7us?whitepaper=ContentAndCommerce",{"_modelApiKey":55,"slug":250,"pardotFormEmbedCode":251,"formEmbedMinHeight":243,"displayTitle":244,"copy":252,"successTitle":234,"successCopy":245},"whitepaper","https:\u002F\u002Fform.fillout.com\u002Ft\u002F5YPWmy8oT7us?whitepaper=Jamstack","\u003Cp>Commerce Layer is the perfect platform for building commerce on the Jamstack. Convert any design into pixel perfect HTML pages. Connect a best-of-breed headless CMS. Go serverless and forget the hassle of managing complex infrastructures.\u003C\u002Fp>\n",{"_modelApiKey":55,"slug":254,"pardotFormEmbedCode":255,"formEmbedMinHeight":256,"displayTitle":257,"copy":258,"successTitle":259,"successCopy":260},"contact-links","https:\u002F\u002Fform.fillout.com\u002Ft\u002FeWPyhHGHT7us",750,"Contact us.","\u003Cp>Tell us about your project. Our team will reach out to you for a personalized offer.\u003C\u002Fp>\n","Thanks for your message!","We’ll be in touch soon to discuss your project details.",{"_modelApiKey":55,"slug":138,"pardotFormEmbedCode":255,"formEmbedMinHeight":256,"displayTitle":257,"copy":258,"successTitle":259,"successCopy":260},{"_modelApiKey":55,"slug":263,"pardotFormEmbedCode":227,"formEmbedMinHeight":228,"displayTitle":264,"successTitle":265,"successCopy":266},"demo-embed","Want to see it in action? Request a demo.","Thanks for your request!","We’ll be in touch soon to arrange a date and time for your free live demo.",{"_modelApiKey":55,"slug":53,"pardotFormEmbedCode":268,"formEmbedMinHeight":228,"displayTitle":269,"copy":270,"successTitle":234,"successCopy":271},"https:\u002F\u002Fform.fillout.com\u002Ft\u002F9MTkDWMUSqus","Become our partner.","\u003Cp>Join us and get our guidance in helping your clients succeed. Our partners are our ambassadors. We are committed to your success as much as you are.\u003C\u002Fp>\n","We will contact you soon to discuss the details of our partnership.",{"_modelApiKey":55,"slug":273,"pardotFormEmbedCode":268,"formEmbedMinHeight":228,"displayTitle":269,"copy":270,"successTitle":234,"successCopy":271},"partners-embed",{"_modelApiKey":55,"slug":143,"pardotFormEmbedCode":227,"formEmbedMinHeight":228,"displayTitle":275,"copy":276,"successTitle":265,"successCopy":266},"Get a free live demo.","\u003Cp>Get a personalized demo and learn more about what Commerce Layer can do for your company.\u003C\u002Fp>\n",{"_modelApiKey":212,"link":278,"subtitle":283,"date":283,"author":284,"additionalAuthors":294,"icon":295,"abstract":296,"tag":297,"displayTitle":279,"cardRatio":299,"featured":11,"seoMetaTags":300,"layout":364,"blogPostCarousel":389,"_seoMetaTags":438,"authors":472},{"text":279,"isExternal":11,"url":280,"link":281},"The new Rules Engine changes the game for how to do promotions.","",{"_modelApiKey":212,"slug":282},"the-new-promotion-rule-engine-changes-the-game-for-how-to-do-promotions","March 20, 2025",{"name":285,"picture":286},"Seth Bindernagel",{"url":287,"alt":288,"title":288,"width":289,"height":289,"format":290,"focalPoint":291,"customData":293},"https:\u002F\u002Fwww.datocms-assets.com\u002F35053\u002F1656680208-seth.jpg","Seth Bindernagel avatar",1280,"jpg",{"x":292,"y":292},0.5,{},[],"faders","Our new Rules Engine empowers businesses to create sophisticated marketing strategies with highly customizable logic, enabling complex, multi-condition incentive programs.",{"color":298,"name":8},"gray","portrait",[301,305,309,312,316,319,322,326,330,334,337,341,345,349,353,356,360],{"attributes":302,"tag":303,"content":304},null,"title","Take promotions to the next level with our new Rules Engine ",{"attributes":306,"tag":308,"content":302},{"property":307,"content":304},"og:title","meta",{"attributes":310,"tag":308,"content":302},{"name":311,"content":304},"twitter:title",{"attributes":313,"tag":308,"content":302},{"name":314,"content":315},"description","Create sophisticated marketing strategies with highly customizable logic and more complex, multi-condition promotions.",{"attributes":317,"tag":308,"content":302},{"property":318,"content":315},"og:description",{"attributes":320,"tag":308,"content":302},{"name":321,"content":315},"twitter:description",{"attributes":323,"tag":308,"content":302},{"property":324,"content":325},"og:image","https:\u002F\u002Fwww.datocms-assets.com\u002F35053\u002F1738235942-cl_promo-rule-engine-02.jpg?auto=format&fit=max&w=1200",{"attributes":327,"tag":308,"content":302},{"property":328,"content":329},"og:image:width","1200",{"attributes":331,"tag":308,"content":302},{"property":332,"content":333},"og:image:height","630",{"attributes":335,"tag":308,"content":302},{"name":336,"content":325},"twitter:image",{"attributes":338,"tag":308,"content":302},{"property":339,"content":340},"og:locale","en",{"attributes":342,"tag":308,"content":302},{"property":343,"content":344},"og:type","article",{"attributes":346,"tag":308,"content":302},{"property":347,"content":348},"og:site_name","Commerce Layer",{"attributes":350,"tag":308,"content":302},{"property":351,"content":352},"article:modified_time","2025-10-08T16:50:12Z",{"attributes":354,"tag":308,"content":302},{"property":355,"content":280},"article:publisher",{"attributes":357,"tag":308,"content":302},{"name":358,"content":359},"twitter:card","summary_large_image",{"attributes":361,"tag":308,"content":302},{"name":362,"content":363},"twitter:site","@commercelayer",[365,371,376,379,381,384,386],{"_modelApiKey":366,"copy":367,"listStyle":368,"darkTheme":11,"buttons":369,"color":370,"indent":7},"wysiwyg","\u003Cp>Today we are announcing the release of our new \u003Ca target=\"_blank\" href=\"https:\u002F\u002Fdocs.commercelayer.io\u002Frules-engine\">Rules Engine\u003C\u002Fa>, a very powerful API that delivers new capabilities to our enterprise customers. The Rules Engine provides the flexibility to create highly customized promotions, discounts, and pricing strategies that will unlock broader growth opportunities previously inaccessible. Customers can use the Engine with our \u003Ca target=\"_blank\" href=\"https:\u002F\u002Fdocs.commercelayer.io\u002Fcore\u002Fapi-reference\u002Fflex_promotions\">Flex Promotions\u003C\u002Fa>, allowing conditions and actions to be defined that automatically apply discounts and promotions based on a wide range of order attributes. Whether you need to target specific customer segments, incentivize purchases of certain products, or offer free shipping based on location, the Rules Engine can cover just about any use case.\u003C\u002Fp>\n\n\u003Ch4>Our solid promotions foundation\u003C\u002Fh4>\n\n\u003Cp>From the beginning, we’ve recognized that ecommerce success can hinge on running effective promotions. A number of industry studies endorse the importance of an effective promotion strategy:\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>91% of consumers say promotions influence their purchasing decisions\u003C\u002Fli>\n\u003Cli>Companies using advanced promotion engines see a 2.5x higher ROI on promotional spend.\u003C\u002Fli>\n\u003Cli>Smart promotional strategies reduce dead stock by up to 35%\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cp>Our core API supports promotions around two key concepts: the promotions themselves and promotion rules. Think of the promotion as the actual discount or benefit, like &quot;20% off&quot; or &quot;free shipping&quot;, while promotion rules are the conditions that need to be met to get that benefit. It&#39;s similar to how a loyalty program might work. The benefit might be a free coffee (i.e. the promotion), but the rule is that you need to buy 10 coffees first.\u003C\u002Fp>\n\n\u003Cp>The initial set of promotions rules we built have been “static”. We’ve offered promotions based on rules like the \u003Ca target=\"_blank\" href=\"https:\u002F\u002Fdocs.commercelayer.io\u002Fcore\u002Fapi-reference\u002Forder_amount_promotion_rules\">order amount\u003C\u002Fa>, \u003Ca target=\"_blank\" href=\"https:\u002F\u002Fdocs.commercelayer.io\u002Fcore\u002Fapi-reference\u002Fsku_list_promotion_rules\">specific products or combinations of products\u003C\u002Fa>, or a \u003Ca target=\"_blank\" href=\"https:\u002F\u002Fdocs.commercelayer.io\u002Fcore\u002Fapi-reference\u002Fcustom_promotion_rules\">set of customizations\u003C\u002Fa> you can configure. These have served as a “semi-smart assistant” that decides when and how to apply discounts to customers&#39; orders. Just as a helpful store employee might say &quot;Oh, you&#39;ve bought over $100 worth of items, so you qualify for our 20% discount!&quot; or &quot;I see you have a coupon code, let me apply that for you,&quot; our promotions API checks that various conditions are met and applies discounts when appropriate.\u003C\u002Fp>\n\n\u003Ch4>How the Rules Engine works\u003C\u002Fh4>\n\n\u003Cp>While the initial set of promotions discussed have covered a large set of the most common use cases, they are still limited in what they can do. Every brand should be able to implement unique promotions with clever rules that help them sell more products. That’s why we created the Rules Engine (with Flex Promotions) to be one of the most powerful promotions engines in the market today.\u003C\u002Fp>\n\n\u003Cp>The Engine allows you to define and manage rules ranging from simple to complex logic. It evaluates specific payloads to ensure conditions are met, triggering the corresponding actions. The Rules Engine comes with a core set of key features:\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>\u003Cstrong>Flexible rule definition:\u003C\u002Fstrong> Supports a wide array of use cases through integration with the Commerce Layer Core API, enabling a versatile promotional system.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Current integrations:\u003C\u002Fstrong> Initially supports promotions and price lists, with plans for expansion to additional resources.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Comprehensive examples:\u003C\u002Fstrong> Provides JSON snippets and examples focused on order rules, adaptable for creating other types of rules.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cp>What makes the Rule Engine different from our existing promotion is that it is a “Domain-Specific Language” (DSL) tailored specifically for commerce applications, allowing precise rule creation and management. And like our first iteration with promotions, the Rules Engine is integrated with our Core API to seamlessly enhance promotional capabilities. The Rules Engine is perfect for businesses seeking advanced promotional tools and flexible rule management to optimize their operations and marketing strategies.\u003C\u002Fp>\n\n\u003Cp>As mentioned above, the Rules Engine will initially power all \u003Ca target=\"_blank\" href=\"https:\u002F\u002Fdocs.commercelayer.io\u002Fcore\u002Fapi-reference\u002Fflex_promotions\">Flex Promotions\u003C\u002Fa>, which provide even more flexibility compared to the Custom Rules described above. (\u003Ca target=\"_blank\" href=\"https:\u002F\u002Fdocs.commercelayer.io\u002Fcore\u002Fapi-reference\u002Fcoupons\">Coupons\u003C\u002Fa> will also work with the new Rules Engine just like they have worked the fixed rules discussed.)\u003C\u002Fp>\n\n\u003Cp>Let’s take a look at some of the powerful things you can do with Flex Promotions and the new Rules Engine.\u003C\u002Fp>\n\n\u003Ch4>Real-world Flex Promotion examples\u003C\u002Fh4>\n\n\u003Cp>The Rules Engine and Flex Promotions require a basic level of knowledge of constructing structured data with JSON. Let&#39;s dive into three practical examples of custom rules to see what the JSON looks like, how they work, and how they can solve specific business needs.\u003C\u002Fp>\n\n\u003Cp>\u003Cstrong>Use case: Discount line items based on price\u003C\u002Fstrong>\u003C\u002Fp>\n\n\u003Cp>In competitive retail environments, strategic discounting on premium products can be an effective way to drive sales of high-value items while maintaining profit margins. This example demonstrates how to configure the rules engine to automatically apply a fixed discount to any product priced above a certain threshold.\u003C\u002Fp>\n\n\u003Cp>This approach allows merchants to incentivize purchases of premium products without affecting the pricing of lower-cost items. It&#39;s particularly useful for increasing the average order value and moving higher-priced inventory.\u003C\u002Fp>\n\n\u003Cp>\u003Cem>The rule\u003C\u002Fem>\u003C\u002Fp>\n\n\u003Cp>This is how you would structure the JSON to create this promotion:\u003C\u002Fp>\n","checkbox",[],"violet",{"_modelApiKey":372,"code":373,"showLineNumbers":11,"highlightLines":280,"language":374,"size":375},"code_block","{\n  \"rules\": [\n    {\n      \"name\": \"Get $25 off if the price of the item is >= $999\",\n      \"conditions\": [\n        {\n          \"field\": \"order.line_items.unit_amount_cents\",\n          \"matcher\": \"gteq\",\n          \"value\": 9999,\n          \"group\": \"discountable-items\"\n        }\n      ],\n      \"actions\": [\n        {\n          \"type\": \"fixed_amount\",\n          \"value\": 2500,\n          \"selector\": \"order.line_items\",\n          \"groups\": [\n            \"discountable-items\"\n          ]\n        }\n      ]\n    }\n  ]\n}","json","Standard",{"_modelApiKey":366,"copy":377,"listStyle":368,"darkTheme":11,"buttons":378,"color":370,"indent":11},"\u003Cp>\u003Cem>How it works\u003C\u002Fem>\u003C\u002Fp>\n\n\u003Col>\n\u003Cli>\u003Cstrong>Condition with Grouping\u003C\u002Fstrong>: The rule identifies and groups qualifying items\n\n\u003Cul>\n\u003Cli>\u003Ccode>field\u003C\u002Fcode>: Targets the unit price of each line item in cents\u003C\u002Fli>\n\u003Cli>\u003Ccode>matcher\u003C\u002Fcode>: &quot;gteq&quot; means &quot;greater than or equal to&quot;\u003C\u002Fli>\n\u003Cli>\u003Ccode>value\u003C\u002Fcode>: 9999 represents $99.99\u003C\u002Fli>\n\u003Cli>\u003Ccode>group\u003C\u002Fcode>: &quot;discountable-items&quot; assigns qualifying items to a named group\u003C\u002Fli>\n\u003C\u002Ful>\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Targeted Action\u003C\u002Fstrong>: Apply a fixed discount to items in the defined group\n\n\u003Cul>\n\u003Cli>\u003Ccode>type\u003C\u002Fcode>: &quot;fixed_amount&quot; indicates a specific dollar amount discount\u003C\u002Fli>\n\u003Cli>\u003Ccode>value\u003C\u002Fcode>: 2500 represents a $25.00 discount\u003C\u002Fli>\n\u003Cli>\u003Ccode>selector\u003C\u002Fcode>: &quot;order.line_items&quot; targets line items in the order\u003C\u002Fli>\n\u003Cli>\u003Ccode>groups\u003C\u002Fcode>: Limits the action to only affect items in the &quot;discountable-items&quot; group\u003C\u002Fli>\n\u003C\u002Ful>\u003C\u002Fli>\n\u003C\u002Fol>\n\n\u003Cp>\u003Cem>Result\u003C\u002Fem>\u003C\u002Fp>\n\n\u003Cp>When a customer adds products priced at $99.99 or more to their cart, each qualifying item automatically receives a $25.00 discount. This discount is applied per item, not just once per order.\u003C\u002Fp>\n\n\u003Cp>Let&#39;s say an order contained 4 line items, but only 2 items met the price threshold. One of the qualifying items had a quantity of 2, resulting in a $50.00 discount for that line (2 × $25.00), while the other qualifying item had a quantity of 1, resulting in a $25.00 discount. The total discount applied would be $75.00 across all qualifying items.\u003C\u002Fp>\n\n\u003Cp>The rules engine handles the identification of eligible items and the application of discounts automatically, without requiring manual intervention or coupon codes.\u003C\u002Fp>\n\n\u003Cp>\u003Cstrong>Use Case: Discount products based on customer email domain\u003C\u002Fstrong>\u003C\u002Fp>\n\n\u003Cp>This example demonstrates a powerful business scenario where you can reward customers from specific organizations with automatic discounts. For instance, you might want to offer special pricing to employees of partner companies, educational institutions, or even your own staff.\u003C\u002Fp>\n\n\u003Cp>The rule below identifies customers based on their email domain and applies a significant discount to all products in their order. This approach allows for precise targeting without requiring coupon codes or manual intervention.\u003C\u002Fp>\n\n\u003Cp>\u003Cem>The rule\u003C\u002Fem>\u003C\u002Fp>\n\n\u003Cp>This is how you would structure the JSON to create this promotion:\u003C\u002Fp>\n",[],{"_modelApiKey":372,"code":380,"showLineNumbers":11,"highlightLines":280,"language":374,"size":375},"{\n  \"rules\": [\n    {\n      \"name\": \"Customer email domain mybrand.com \u002F example.com\",\n      \"conditions_logic\": \"or\",\n      \"conditions\": [\n        {\n          \"field\": \"order.customer_email\",\n          \"matcher\": \"matches\",\n          \"value\": \".*@mybrand.com\"\n        },\n        {\n          \"field\": \"order.customer_email\",\n          \"matcher\": \"matches\",\n          \"value\": \".*@example.com\"\n        }\n      ],\n      \"actions\": [\n        {\n          \"type\": \"percentage\",\n          \"selector\": \"order.line_items.sku\",\n          \"value\": 0.15\n        }\n      ]\n    }\n  ]\n}",{"_modelApiKey":366,"copy":382,"listStyle":368,"darkTheme":11,"buttons":383,"color":370,"indent":11},"\u003Cp>\u003Cem>How it works\u003C\u002Fem>\u003C\u002Fp>\n\n\u003Col>\n\u003Cli>\u003Cstrong>Multiple Conditions with OR Logic\u003C\u002Fstrong>: The rule uses two conditions connected by &quot;or&quot; logic\n\n\u003Cul>\n\u003Cli>\u003Ccode>conditions_logic\u003C\u002Fcode>: &quot;or&quot; means either condition can trigger the action\u003C\u002Fli>\n\u003Cli>First condition: Checks if email ends with &quot;@mybrand.com&quot;\u003C\u002Fli>\n\u003Cli>Second condition: Checks if email ends with &quot;@example.com&quot;\u003C\u002Fli>\n\u003Cli>\u003Ccode>matcher\u003C\u002Fcode>: &quot;matches&quot; allows for pattern matching using regular expressions\u003C\u002Fli>\n\u003C\u002Ful>\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Targeted Action\u003C\u002Fstrong>: When either condition is met, apply a 15% discount to all SKU items\n\n\u003Cul>\n\u003Cli>\u003Ccode>type\u003C\u002Fcode>: &quot;percentage&quot; for a percentage-based discount\u003C\u002Fli>\n\u003Cli>\u003Ccode>selector\u003C\u002Fcode>: &quot;order.line_items.sku&quot; targets only line items with SKUs\u003C\u002Fli>\n\u003Cli>\u003Ccode>value\u003C\u002Fcode>: 0.15 represents a 15% discount\u003C\u002Fli>\n\u003C\u002Ful>\u003C\u002Fli>\n\u003C\u002Fol>\n\n\u003Cp>\u003Cem>Result\u003C\u002Fem>\u003C\u002Fp>\n\n\u003Cp>When a customer with an email address from either &quot;@mybrand.com&quot; or &quot;@example.com&quot; places an order, all products with SKUs automatically receive a 15% discount. This allows businesses to offer special pricing to partner organizations or specific customer segments.\u003C\u002Fp>\n\n\u003Cp>Let&#39;s say a customer with the email &quot;\u003Ca href=\"mailto:john.doe@mybrand.com\">john.doe@mybrand.com\u003C\u002Fa>&quot; placed an order containing 5 line items, 4 of which qualified. The Rules Engine would identify the qualifying email domain and apply the 15% discount to all 4 SKU items.\u003C\u002Fp>\n\n\u003Cp>\u003Cstrong>Use case: Automatic discount for credit card payments\u003C\u002Fstrong>\u003C\u002Fp>\n\n\u003Cp>In today&#39;s competitive ecommerce landscape, encouraging customers to use specific payment methods can provide significant business advantages. This example demonstrates how to configure the Rules Engine to automatically reward customers who choose to pay with credit cards by applying an instant discount to their purchase.\u003C\u002Fp>\n\n\u003Cp>By incentivizing credit card payments, merchants can benefit from faster settlement times, reduced payment processing fees (compared to some alternative payment methods), and potentially higher conversion rates. This rule makes the incentive transparent and automatic, enhancing the customer experience.\u003C\u002Fp>\n\n\u003Cp>\u003Cem>The rule\u003C\u002Fem>\u003C\u002Fp>\n\n\u003Cp>This is how you would structure the JSON to create this promotion:\u003C\u002Fp>\n",[],{"_modelApiKey":372,"code":385,"showLineNumbers":11,"highlightLines":280,"language":374,"size":375},"{\n  \"rules\": [\n    {\n      \"name\": \"Discount 3% if paid by credit card\",\n      \"conditions\": [\n        {\n          \"field\": \"order.payment_method.payment_source_type\",\n          \"matcher\": \"eq\",\n          \"value\": \"credit_cards\"\n        }\n      ],\n      \"actions\": [\n        {\n          \"type\": \"percentage\",\n          \"selector\": \"order\",\n          \"value\": 0.03\n        }\n      ]\n    }\n  ]\n}",{"_modelApiKey":366,"copy":387,"listStyle":368,"darkTheme":11,"buttons":388,"color":370,"indent":11},"\u003Cp>\u003Cem>How it works\u003C\u002Fem>\u003C\u002Fp>\n\n\u003Col>\n\u003Cli>\u003Cstrong>Condition\u003C\u002Fstrong>: The rule checks if the payment source type is &quot;credit_cards&quot;\n\n\u003Cul>\n\u003Cli>\u003Ccode>field\u003C\u002Fcode>: Specifies the path to check in the order object\u003C\u002Fli>\n\u003Cli>\u003Ccode>matcher\u003C\u002Fcode>: &quot;eq&quot; means &quot;equals&quot;\u003C\u002Fli>\n\u003Cli>\u003Ccode>value\u003C\u002Fcode>: &quot;credit_cards&quot; is what we&#39;re looking for\u003C\u002Fli>\n\u003C\u002Ful>\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Action\u003C\u002Fstrong>: When the condition is met, apply a 3% discount\n\n\u003Cul>\n\u003Cli>\u003Ccode>type\u003C\u002Fcode>: &quot;percentage&quot; indicates a percent-based discount\u003C\u002Fli>\n\u003Cli>\u003Ccode>selector\u003C\u002Fcode>: &quot;order&quot; means apply to the entire order\u003C\u002Fli>\n\u003Cli>\u003Ccode>value\u003C\u002Fcode>: 0.03 represents 3%\u003C\u002Fli>\n\u003C\u002Ful>\u003C\u002Fli>\n\u003C\u002Fol>\n\n\u003Cp>\u003Cem>Result\u003C\u002Fem>\u003C\u002Fp>\n\n\u003Cp>When a customer places an order and selects a credit card as their payment method, the system automatically applies a 3% discount to their entire order total. This discount is reflected in the final price shown to the customer.\u003C\u002Fp>\n\n\u003Cp>The Rules Engine evaluates the order data, confirms that the payment source type matches &quot;credit_cards&quot;, and then calculates and applies the appropriate discount amount without requiring any manual intervention or coupon codes.\u003C\u002Fp>\n\n\u003Ch4>Wrapping it up\u003C\u002Fh4>\n\n\u003Cp>The Rule Engine provides a very advanced framework for creating sophisticated promotional strategies. We believe it is one of the most powerful rules engine on the market today that offered as a core part of an ecommerce API. For new users, it will take a bit of time to understand what you can do to create targeted, effective promotions that drive new growth. But we will continue to post use cases that can be easily replicated by your team. The new engine provides powerful controls to take any promotional strategy to the highest level. And while the engine is powerful, it&#39;s also designed to be predictable and manageable. Anyone can start with simple rule combinations and gradually build up to more complex promotional scenarios as they become more comfortable with the system&#39;s capabilities.\u003C\u002Fp>\n\n\u003Cp>For now, if you’re interested in using the Rules Engine, you need to be an enterprise customer. Please don’t hesitate to reach out. Contact our Sales team to learn more. Once the new Promotion Rules Engine is open for general availability, we’ll write a follow up blog post with more use cases as well as specific ins-and-outs for how the Rules Engine works. Stay tuned. \u003C\u002Fp>\n\n\u003Cp>Was this post helpful? Let us know what you think by emailing us or joining our Discord channel by clicking on the module below this post. We are always here to help.\u003C\u002Fp>\n\n\u003Cp>Good luck on your promotions.\u003C\u002Fp>\n",[],{"displayTitle":390,"cta":302,"ctaText":280,"cards":391},"Your next read",[392,410,424],{"_modelApiKey":212,"link":393,"subtitle":397,"date":397,"author":398,"additionalAuthors":405,"icon":406,"abstract":407,"tag":408,"displayTitle":394,"cardRatio":299,"featured":409},{"text":394,"isExternal":11,"url":280,"link":395},"Build better promotional campaigns and spark growth with our new Promotions app.",{"_modelApiKey":212,"slug":396},"build-better-promo-campaigns-with-our-new-promotions-app","April 30, 2024",{"name":399,"picture":400},"Daniel Oh",{"url":401,"alt":402,"title":402,"width":289,"height":289,"format":290,"focalPoint":403,"customData":404},"https:\u002F\u002Fwww.datocms-assets.com\u002F35053\u002F1658849633-daniel.jpg","Daniel Oh avatar",{"x":292,"y":292},{},[],"shooting-star","Build better campaigns and drive growth and customer retention with our new Promotions App.",{"color":298,"name":8},0,{"_modelApiKey":212,"link":411,"subtitle":415,"date":415,"author":416,"additionalAuthors":420,"icon":203,"abstract":421,"tag":422,"displayTitle":412,"cardRatio":11,"featured":423},{"text":412,"isExternal":11,"url":280,"link":413},"How to get the most from Commerce Layer Links.",{"_modelApiKey":212,"slug":414},"how-to-get-the-most-from-links","November 20, 2024",{"name":285,"picture":417},{"url":287,"alt":288,"title":288,"width":289,"height":289,"format":290,"focalPoint":418,"customData":419},{"x":292,"y":292},{},[],"Links are a no-code tool you can use to bring your stock online today and sell on any channel, in any market.",{"color":298,"name":8},1,{"_modelApiKey":212,"link":425,"subtitle":429,"date":429,"author":430,"additionalAuthors":434,"icon":435,"abstract":436,"tag":437,"displayTitle":426,"cardRatio":11,"featured":38},{"text":426,"isExternal":11,"url":280,"link":427},"Omnichannel retail management with the Stores API.",{"_modelApiKey":212,"slug":428},"omnichannel-retail-management-with-the-stores-api","December 10, 2024",{"name":285,"picture":431},{"url":287,"alt":288,"title":288,"width":289,"height":289,"format":290,"focalPoint":432,"customData":433},{"x":292,"y":292},{},[],"storefront","The Stores API provides more granularity to manage inventory, localized payment methods, and shipments more intelligently.",{"color":298,"name":8},[439,440,442,444,446,448,450,452,454,456,458,460,462,464,466,468,470],{"attributes":302,"tag":303,"content":304},{"attributes":441,"tag":308,"content":302},{"property":307,"content":304},{"attributes":443,"tag":308,"content":302},{"name":311,"content":304},{"attributes":445,"tag":308,"content":302},{"name":314,"content":315},{"attributes":447,"tag":308,"content":302},{"property":318,"content":315},{"attributes":449,"tag":308,"content":302},{"name":321,"content":315},{"attributes":451,"tag":308,"content":302},{"property":324,"content":325},{"attributes":453,"tag":308,"content":302},{"property":328,"content":329},{"attributes":455,"tag":308,"content":302},{"property":332,"content":333},{"attributes":457,"tag":308,"content":302},{"name":336,"content":325},{"attributes":459,"tag":308,"content":302},{"property":339,"content":340},{"attributes":461,"tag":308,"content":302},{"property":343,"content":344},{"attributes":463,"tag":308,"content":302},{"property":347,"content":348},{"attributes":465,"tag":308,"content":302},{"property":351,"content":352},{"attributes":467,"tag":308,"content":302},{"property":355,"content":280},{"attributes":469,"tag":308,"content":302},{"name":358,"content":359},{"attributes":471,"tag":308,"content":302},{"name":362,"content":363},[473],{"name":285,"picture":474},{"url":287,"alt":288,"title":288,"width":289,"height":289,"format":290,"focalPoint":475,"customData":476},{"x":292,"y":292},{},1790593727266]