{"id":5300,"date":"2021-11-30T11:53:33","date_gmt":"2021-11-30T11:53:33","guid":{"rendered":"https:\/\/www.icreativetechnologies.com\/?p=5300"},"modified":"2021-11-30T11:53:33","modified_gmt":"2021-11-30T11:53:33","slug":"how-to-add-custom-rules-in-shopware6","status":"publish","type":"post","link":"https:\/\/www.icreativetechnologies.com\/de\/how-to-add-custom-rules-in-shopware6\/","title":{"rendered":"How to add custom rules in Shopware6"},"content":{"rendered":"<h2>Add custom rules<\/h2>\n<h3>Overview<\/h3>\n<p>In this guide, you&#8217;ll learn how to create rules in Shopware. Rules are created by the rule builder.<br \/>\nThis example will introduce a new rule, which checks if there&#8217;s currently a lunar eclipse or not. The shop owner is then able to react to a lunar eclipse with special prices or dispatch methods.<\/p>\n<h3>Prerequisites<\/h3>\n<p>To add your own custom rules for your plugin, you first need a plugin as a base. Therefore, you can refer to the Plugin Base Guide.<br \/>\n(https:\/\/developer.shopware.com\/docs\/guides\/plugins\/plugins\/plugin-base-guide)<br \/>\nYou also should be familiar with the Dependency Injection container as this is used to register your custom rule.<\/p>\n<h3>Create custom rule<\/h3>\n<p>To create a custom rule, we have to implement both backend (PHP) code and a user interface in the administration to manage it. Let&#8217;s start with the PHP part first, which handles the main logic of our rule.<br \/>\nFirst of all we need a new Rule class, in this example we will name it LunarEclipseRule. It will be placed in the directory \/src\/Core\/Rule. Our new class has to extend from the abstract class Shopware\\Core\\Framework\\Rule\\Rule. Below you can find an example implementation.<\/p>\n<p>\/src\/Core\/Rule\/LunarEclipseRule.php<\/p>\n<div class=\"shopware-blog-code\">\n<p><!--?php declare(strict_types=1); namespace Swag\\BasicExample\\Core\\Rule; use Shopware\\Core\\Framework\\Rule\\Rule; use Shopware\\Core\\Framework\\Rule\\RuleScope; use Symfony\\Component\\Validator\\Constraints\\Type; class LunarEclipseRule extends Rule { \/** * @var bool *\/ protected $isLunarEclipse; \/\/ 'protected' is very important here! public function __construct() { parent::__construct(); \/\/ Will be overwritten at runtime. Reflects the expected value. $this-&gt;isLunarEclipse = false;&lt;br ?--> }<\/p>\n<p>public function getName(): string<br \/>\n{<br \/>\nreturn &#8216;lunar_eclipse&#8217;;<br \/>\n}<\/p>\n<p>public function match(RuleScope $scope): bool<br \/>\n{<br \/>\n\/\/ Not implemented in this example<br \/>\n$isCurrentlyLunarEclipse = $this-&gt;isCurrentlyLunarEclipse();<\/p>\n<p>\/\/ Checks if the shop owner set the rule to &#8220;Lunar eclipse =&gt; Yes&#8221;<br \/>\nif ($this-&gt;isLunarEclipse) {<br \/>\n\/\/ Shop administrator wants the rule to match if there&#8217;s currently a lunar eclipse.<br \/>\nreturn $isCurrentlyLunarEclipse;<br \/>\n}<\/p>\n<p>\/\/ Shop administrator wants the rule to match if there&#8217;s currently NOT a lunar eclipse.<br \/>\nreturn !$isCurrentlyLunarEclipse;<br \/>\n}<\/p>\n<p>public function getConstraints(): array<br \/>\n{<br \/>\nreturn [<br \/>\n&#8216;isLunarEclipse&#8217; =&gt; [ new Type(&#8216;bool&#8217;) ]<br \/>\n];<br \/>\n}<br \/>\n}<\/p>\n<\/div>\n<p>As you can see, several methods are already implemented:<\/p>\n<ul>\n<li>__constructor: This only defines the default expected value. This is overwritten at runtime with the actual value that the shop owner set in the administration.<\/li>\n<li>getName: Returns a unique technical name for your rule.<\/li>\n<li>match: This checks whether the rule applies. Accordingly, a boolean is returned whether the rule applies or not.<\/li>\n<li>getConstraints: This method returns an array of the possible fields and their types. You could also return the NotBlank class here, to require this field.<\/li>\n<\/ul>\n<p>After we&#8217;ve created our rule class, we have to register it in our services.xml and tag it as Shopware.rule.definition. Please keep in mind: The variables to be used in the rule have to be &#8216;protected&#8217; and not &#8216;private&#8217;, otherwise, they won&#8217;t work properly.<br \/>\nNOTE : Never execute database queries or any other time consuming operations within the match() method of your rule, as it will drastically impact the performance of your store. Stick to the rule scope when evaluating whether your rule matches or not.<\/p>\n<h2>Active rules<\/h2>\n<p>You can access all active rules by using the getRuleIds method of the context.<\/p>\n<p><span class=\"shopware-blog-code\">$context-&gt;getRuleIds();<\/span><\/p>\n<h2>Showing rule in the administration<\/h2>\n<p>Now we want to implement our new rule in the administration so that we can manage it. To achieve this, we have to call the addCondition method of the RuleConditionService, by decorating this service. The decoration of services in the administration will be covered in our Adding services guide.<br \/>\n(https:\/\/developer.shopware.com\/docs\/guides\/plugins\/plugins\/administration\/add-custom-service)<br \/>\nCreate a new directory called \/src\/Resources\/app\/administration\/src\/decorator. In this directory we create a new file called rule-condition-service-decoration.js.<br \/>\n\/src\/Resources\/app\/administration\/src\/decorator\/rule-condition-service-decoration.js<\/p>\n<div class=\"shopware-blog-code\">\n<p>import &#8216;..\/core\/component\/swag-lunar-eclipse&#8217;;<\/p>\n<p>Shopware.Application.addServiceProviderDecorator(&#8216;ruleConditionDataProviderService&#8217;, (ruleConditionService) =&gt; {<br \/>\nruleConditionService.addCondition(&#8216;lunar_eclipse&#8217;, {<br \/>\ncomponent: &#8216;swag-lunar-eclipse&#8217;,<br \/>\nlabel: &#8216;Is lunar eclipse today&#8217;,<br \/>\nscopes: [&#8216;global&#8217;]<br \/>\n});<\/p>\n<p>return ruleConditionService;<br \/>\n});<\/p>\n<\/div>\n<p>As you can see, this is decorating the RuleConditionService by using its name ruleConditionDataProviderService. The decoration adds a new condition called lunar_eclipse. Make sure to match the name we&#8217;ve used in the getName method in PHP. Next, we define the component, in our case swag-lunar-eclipse, which is responsible for rendering the rule inside the administration. We will create this component in the next step. Furthermore, we defined a label, which will be displayed in the rule builder selection. The last option is the scope, which in our case is global, as we have not specified a specific one in our core class.<\/p>\n<p>We also have to create a main.js file in our administration sources directory and import the decorator file we&#8217;ve created above. The main.js file is used as an entry point to load administration modules from Shopware plugins:<br \/>\n\/src\/Resources\/app\/administration\/src\/main.js<\/p>\n<p><span class=\"shopware-blog-code\">import &#8216;.\/decorator\/rule-condition-service-decoration&#8217;;<\/span><\/p>\n<h2>Custom rule component<\/h2>\n<p>Since we&#8217;ve registered our rule to the administration now, we&#8217;re still lacking the actual component swag-lunar-eclipse. As previously mentioned, we&#8217;ve already defined a path for it in our service decoration. So create the following directory: \/src\/Resources\/app\/administration\/src\/core\/component\/swag-lunar-eclipse. If you are not familiar with creating components in Shopware, take a look at our Add your own component guide.<\/p>\n<p>Here&#8217;s an example of what this component could look like:<\/p>\n<p>\/src\/Resources\/app\/administration\/src\/core\/component\/swag-lunar-eclipse\/index.js<br \/>\nimport template from &#8216;.\/swag-lunar-eclipse.html.twig&#8217;;<\/p>\n<div class=\"shopware-blog-code\">Shopware.Component.extend(&#8216;swag-lunar-eclipse&#8217;, &#8216;sw-condition-base&#8217;, {<br \/>\ntemplate,computed: {<br \/>\nselectValues() {<br \/>\nreturn [<br \/>\n{<br \/>\nlabel: this.$tc(&#8216;global.sw-condition.condition.yes&#8217;),<br \/>\nvalue: true<br \/>\n},<br \/>\n{<br \/>\nlabel: this.$tc(&#8216;global.sw-condition.condition.no&#8217;),<br \/>\nvalue: false<br \/>\n}<br \/>\n];<br \/>\n},isLunarEclipse: {<br \/>\nget() {<br \/>\nthis.ensureValueExist();if (this.condition.value.isLunarEclipse == null) {<br \/>\nthis.condition.value.isLunarEclipse = false;<br \/>\n}return this.condition.value.isLunarEclipse;<br \/>\n},<br \/>\nset(isLunarEclipse) {<br \/>\nthis.ensureValueExist();<br \/>\nthis.condition.value = { &#8230;this.condition.value, isLunarEclipse };<br \/>\n}<br \/>\n}<br \/>\n}<br \/>\n});<\/div>\n<p>As you can see, our swag-lunar-eclipse has to extend from the sw-condition-base component and has to bring a custom template, which will be explained in the next step. Let&#8217;s have a look at each property and method. The first computed property is selectValues, which returns an array containing the values &#8220;true&#8221; and &#8220;false&#8221;. Those will be used in the template later on, as they will be the selectable options for the shop administrator. Do not get confused by the call this.$tc(&#8216;global.sw-condition.condition.yes&#8217;), it&#8217;s just loading a translation by its name, in this case &#8220;Yes&#8221; and &#8220;No&#8221;.<\/p>\n<p>Note: When dealing with boolean values, make sure to always return strings here!<\/p>\n<p>The second and last computed property is isLunarEclipse, which uses a getter and setter to define the value of the condition.<\/p>\n<h2>Custom rule component<\/h2>\n<p>The last step is, creating a template for our condition. We will create a new file called swag-lunar-eclipse.html.twig in the same directory as the component. In our template, we have to overwrite the block sw_condition_value_content. In this example we define a sw-single-select in this block.<\/p>\n<p>plugin root&gt;\/src\/Resources\/app\/administration\/src\/core\/component\/swag-lunar-eclipse\/swag-lunar-eclipse.html.twig<\/p>\n<div class=\"shopware-blog-code\">\n<p>{% block sw_condition_value_content %}<\/p>\n<p>{% endblock %}<\/p>\n<\/div>\n<p>As you can see, our sw-single-select uses the previously created computed property selectValues as the options prop, and the value is saved into the variable isLunarEclipse. That&#8217;s it, your rule is now fully integrated.<\/p>\n<h4>To Conclude:<\/h4>\n<p>We hope you&#8217;ve got a good set of answers to your questions from the above. For more professional consulting and development tasks do get in touch with iCreative technologies a Shopware business partner company, and upgrade your Shopware eCommerce Shop to the best in standard.<\/p>\n<p>Know more about our <a href=\"\/shopware-development-services\/\" target=\"_blank\" rel=\"noopener\">Shopware Development Services<\/a>.<\/p>\n<p><a href=\"\/request-quote\/\" target=\"_blank\" rel=\"noopener\">Get in touch<\/a> if you need a customised quote for your Shopware 5 and Shopware6 plugins as well as webshops.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Add custom rules Overview In this guide, you&#8217;ll learn how to create [&hellip;]<\/p>\n","protected":false},"author":8,"featured_media":18441,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[86],"tags":[],"class_list":["post-5300","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-shopware"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to add custom rules in Shopware6 - iCreative Technologies<\/title>\n<meta name=\"description\" content=\"Learn through our blog - How to add custom rules in Shopware6. Rules are created by the rule builder. Add your own custom rules for your plugin.\" \/>\n<meta name=\"robots\" content=\"noindex, follow\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to add custom rules in Shopware6 - iCreative Technologies\" \/>\n<meta property=\"og:description\" content=\"Learn through our blog - How to add custom rules in Shopware6. Rules are created by the rule builder. Add your own custom rules for your plugin.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.icreativetechnologies.com\/de\/how-to-add-custom-rules-in-shopware6\/\" \/>\n<meta property=\"og:site_name\" content=\"iCreative Technologies\" \/>\n<meta property=\"article:published_time\" content=\"2021-11-30T11:53:33+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.icreativetechnologies.com\/wp-content\/uploads\/2021\/11\/Black-and-White-Shapes-and-Widgets-YouTube-Channel-Art-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"1080\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Rajanik Bambhaniya - Shopware 6 Team Lead\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Verfasst von\" \/>\n\t<meta name=\"twitter:data1\" content=\"Rajanik Bambhaniya - Shopware 6 Team Lead\" \/>\n\t<meta name=\"twitter:label2\" content=\"Gesch\u00e4tzte Lesezeit\" \/>\n\t<meta name=\"twitter:data2\" content=\"5\u00a0Minuten\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.icreativetechnologies.com\\\/how-to-add-custom-rules-in-shopware6\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.icreativetechnologies.com\\\/how-to-add-custom-rules-in-shopware6\\\/\"},\"author\":{\"name\":\"Rajanik Bambhaniya - Shopware 6 Team Lead\",\"@id\":\"https:\\\/\\\/www.icreativetechnologies.com\\\/#\\\/schema\\\/person\\\/66d9c33c2e2e219aafa7f95176cce629\"},\"headline\":\"How to add custom rules in Shopware6\",\"datePublished\":\"2021-11-30T11:53:33+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.icreativetechnologies.com\\\/how-to-add-custom-rules-in-shopware6\\\/\"},\"wordCount\":1224,\"publisher\":{\"@id\":\"https:\\\/\\\/www.icreativetechnologies.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.icreativetechnologies.com\\\/how-to-add-custom-rules-in-shopware6\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.icreativetechnologies.com\\\/wp-content\\\/uploads\\\/2021\\\/11\\\/Black-and-White-Shapes-and-Widgets-YouTube-Channel-Art-1.png\",\"articleSection\":[\"Shopware\"],\"inLanguage\":\"de\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.icreativetechnologies.com\\\/how-to-add-custom-rules-in-shopware6\\\/\",\"url\":\"https:\\\/\\\/www.icreativetechnologies.com\\\/how-to-add-custom-rules-in-shopware6\\\/\",\"name\":\"How to add custom rules in Shopware6 - iCreative Technologies\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.icreativetechnologies.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.icreativetechnologies.com\\\/how-to-add-custom-rules-in-shopware6\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.icreativetechnologies.com\\\/how-to-add-custom-rules-in-shopware6\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.icreativetechnologies.com\\\/wp-content\\\/uploads\\\/2021\\\/11\\\/Black-and-White-Shapes-and-Widgets-YouTube-Channel-Art-1.png\",\"datePublished\":\"2021-11-30T11:53:33+00:00\",\"description\":\"Learn through our blog - How to add custom rules in Shopware6. Rules are created by the rule builder. Add your own custom rules for your plugin.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.icreativetechnologies.com\\\/how-to-add-custom-rules-in-shopware6\\\/#breadcrumb\"},\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.icreativetechnologies.com\\\/how-to-add-custom-rules-in-shopware6\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@id\":\"https:\\\/\\\/www.icreativetechnologies.com\\\/how-to-add-custom-rules-in-shopware6\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.icreativetechnologies.com\\\/wp-content\\\/uploads\\\/2021\\\/11\\\/Black-and-White-Shapes-and-Widgets-YouTube-Channel-Art-1.png\",\"contentUrl\":\"https:\\\/\\\/www.icreativetechnologies.com\\\/wp-content\\\/uploads\\\/2021\\\/11\\\/Black-and-White-Shapes-and-Widgets-YouTube-Channel-Art-1.png\",\"width\":1920,\"height\":1080,\"caption\":\"Black-and-White-Shapes-and-Widgets-YouTube-Channel-Art-1\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.icreativetechnologies.com\\\/how-to-add-custom-rules-in-shopware6\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.icreativetechnologies.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to add custom rules in Shopware6\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.icreativetechnologies.com\\\/#website\",\"url\":\"https:\\\/\\\/www.icreativetechnologies.com\\\/\",\"name\":\"iCreative Technologies\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.icreativetechnologies.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.icreativetechnologies.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"de\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.icreativetechnologies.com\\\/#organization\",\"name\":\"iCreative Technologies\",\"url\":\"https:\\\/\\\/www.icreativetechnologies.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@id\":\"https:\\\/\\\/www.icreativetechnologies.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.icreativetechnologies.com\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/logo-e1628229333795.png.png\",\"contentUrl\":\"https:\\\/\\\/www.icreativetechnologies.com\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/logo-e1628229333795.png.png\",\"width\":240,\"height\":66,\"caption\":\"iCreative Technologies\"},\"image\":{\"@id\":\"https:\\\/\\\/www.icreativetechnologies.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.icreativetechnologies.com\\\/#\\\/schema\\\/person\\\/66d9c33c2e2e219aafa7f95176cce629\",\"name\":\"Rajanik Bambhaniya - Shopware 6 Team Lead\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ab8ee394ffda3b27429710e11341d6b1c3d8f608fc12db315b94e7adbb74c19a?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ab8ee394ffda3b27429710e11341d6b1c3d8f608fc12db315b94e7adbb74c19a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ab8ee394ffda3b27429710e11341d6b1c3d8f608fc12db315b94e7adbb74c19a?s=96&d=mm&r=g\",\"caption\":\"Rajanik Bambhaniya - Shopware 6 Team Lead\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to add custom rules in Shopware6 - iCreative Technologies","description":"Learn through our blog - How to add custom rules in Shopware6. Rules are created by the rule builder. Add your own custom rules for your plugin.","robots":{"index":"noindex","follow":"follow"},"og_locale":"de_DE","og_type":"article","og_title":"How to add custom rules in Shopware6 - iCreative Technologies","og_description":"Learn through our blog - How to add custom rules in Shopware6. Rules are created by the rule builder. Add your own custom rules for your plugin.","og_url":"https:\/\/www.icreativetechnologies.com\/de\/how-to-add-custom-rules-in-shopware6\/","og_site_name":"iCreative Technologies","article_published_time":"2021-11-30T11:53:33+00:00","og_image":[{"width":1920,"height":1080,"url":"https:\/\/www.icreativetechnologies.com\/wp-content\/uploads\/2021\/11\/Black-and-White-Shapes-and-Widgets-YouTube-Channel-Art-1.png","type":"image\/png"}],"author":"Rajanik Bambhaniya - Shopware 6 Team Lead","twitter_card":"summary_large_image","twitter_misc":{"Verfasst von":"Rajanik Bambhaniya - Shopware 6 Team Lead","Gesch\u00e4tzte Lesezeit":"5\u00a0Minuten"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.icreativetechnologies.com\/how-to-add-custom-rules-in-shopware6\/#article","isPartOf":{"@id":"https:\/\/www.icreativetechnologies.com\/how-to-add-custom-rules-in-shopware6\/"},"author":{"name":"Rajanik Bambhaniya - Shopware 6 Team Lead","@id":"https:\/\/www.icreativetechnologies.com\/#\/schema\/person\/66d9c33c2e2e219aafa7f95176cce629"},"headline":"How to add custom rules in Shopware6","datePublished":"2021-11-30T11:53:33+00:00","mainEntityOfPage":{"@id":"https:\/\/www.icreativetechnologies.com\/how-to-add-custom-rules-in-shopware6\/"},"wordCount":1224,"publisher":{"@id":"https:\/\/www.icreativetechnologies.com\/#organization"},"image":{"@id":"https:\/\/www.icreativetechnologies.com\/how-to-add-custom-rules-in-shopware6\/#primaryimage"},"thumbnailUrl":"https:\/\/www.icreativetechnologies.com\/wp-content\/uploads\/2021\/11\/Black-and-White-Shapes-and-Widgets-YouTube-Channel-Art-1.png","articleSection":["Shopware"],"inLanguage":"de"},{"@type":"WebPage","@id":"https:\/\/www.icreativetechnologies.com\/how-to-add-custom-rules-in-shopware6\/","url":"https:\/\/www.icreativetechnologies.com\/how-to-add-custom-rules-in-shopware6\/","name":"How to add custom rules in Shopware6 - iCreative Technologies","isPartOf":{"@id":"https:\/\/www.icreativetechnologies.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.icreativetechnologies.com\/how-to-add-custom-rules-in-shopware6\/#primaryimage"},"image":{"@id":"https:\/\/www.icreativetechnologies.com\/how-to-add-custom-rules-in-shopware6\/#primaryimage"},"thumbnailUrl":"https:\/\/www.icreativetechnologies.com\/wp-content\/uploads\/2021\/11\/Black-and-White-Shapes-and-Widgets-YouTube-Channel-Art-1.png","datePublished":"2021-11-30T11:53:33+00:00","description":"Learn through our blog - How to add custom rules in Shopware6. Rules are created by the rule builder. Add your own custom rules for your plugin.","breadcrumb":{"@id":"https:\/\/www.icreativetechnologies.com\/how-to-add-custom-rules-in-shopware6\/#breadcrumb"},"inLanguage":"de","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.icreativetechnologies.com\/how-to-add-custom-rules-in-shopware6\/"]}]},{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/www.icreativetechnologies.com\/how-to-add-custom-rules-in-shopware6\/#primaryimage","url":"https:\/\/www.icreativetechnologies.com\/wp-content\/uploads\/2021\/11\/Black-and-White-Shapes-and-Widgets-YouTube-Channel-Art-1.png","contentUrl":"https:\/\/www.icreativetechnologies.com\/wp-content\/uploads\/2021\/11\/Black-and-White-Shapes-and-Widgets-YouTube-Channel-Art-1.png","width":1920,"height":1080,"caption":"Black-and-White-Shapes-and-Widgets-YouTube-Channel-Art-1"},{"@type":"BreadcrumbList","@id":"https:\/\/www.icreativetechnologies.com\/how-to-add-custom-rules-in-shopware6\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.icreativetechnologies.com\/"},{"@type":"ListItem","position":2,"name":"How to add custom rules in Shopware6"}]},{"@type":"WebSite","@id":"https:\/\/www.icreativetechnologies.com\/#website","url":"https:\/\/www.icreativetechnologies.com\/","name":"iCreative Technologies","description":"","publisher":{"@id":"https:\/\/www.icreativetechnologies.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.icreativetechnologies.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"de"},{"@type":"Organization","@id":"https:\/\/www.icreativetechnologies.com\/#organization","name":"iCreative Technologies","url":"https:\/\/www.icreativetechnologies.com\/","logo":{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/www.icreativetechnologies.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.icreativetechnologies.com\/wp-content\/uploads\/2024\/11\/logo-e1628229333795.png.png","contentUrl":"https:\/\/www.icreativetechnologies.com\/wp-content\/uploads\/2024\/11\/logo-e1628229333795.png.png","width":240,"height":66,"caption":"iCreative Technologies"},"image":{"@id":"https:\/\/www.icreativetechnologies.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.icreativetechnologies.com\/#\/schema\/person\/66d9c33c2e2e219aafa7f95176cce629","name":"Rajanik Bambhaniya - Shopware 6 Team Lead","image":{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/secure.gravatar.com\/avatar\/ab8ee394ffda3b27429710e11341d6b1c3d8f608fc12db315b94e7adbb74c19a?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/ab8ee394ffda3b27429710e11341d6b1c3d8f608fc12db315b94e7adbb74c19a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ab8ee394ffda3b27429710e11341d6b1c3d8f608fc12db315b94e7adbb74c19a?s=96&d=mm&r=g","caption":"Rajanik Bambhaniya - Shopware 6 Team Lead"}}]}},"_links":{"self":[{"href":"https:\/\/www.icreativetechnologies.com\/de\/wp-json\/wp\/v2\/posts\/5300","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.icreativetechnologies.com\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.icreativetechnologies.com\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.icreativetechnologies.com\/de\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/www.icreativetechnologies.com\/de\/wp-json\/wp\/v2\/comments?post=5300"}],"version-history":[{"count":0,"href":"https:\/\/www.icreativetechnologies.com\/de\/wp-json\/wp\/v2\/posts\/5300\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.icreativetechnologies.com\/de\/wp-json\/wp\/v2\/media\/18441"}],"wp:attachment":[{"href":"https:\/\/www.icreativetechnologies.com\/de\/wp-json\/wp\/v2\/media?parent=5300"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.icreativetechnologies.com\/de\/wp-json\/wp\/v2\/categories?post=5300"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.icreativetechnologies.com\/de\/wp-json\/wp\/v2\/tags?post=5300"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}