Pimcore guides &amp; How to 2 min read

# How to create custom condition inside pricing rules

Gain full control over Pimcore's pricing rules and learn how to create your own custom conditions!

Last updated on 29 August, 2025

## Key takeaways

1. Pimcore eCommerce pricing rules and conditions are defined in YAML under pimcore\_ecommerce\_framework in the pricing\_manager section.
2. A custom pricing condition, such as a minimum order weight, must implement Pimcore's ConditionInterface with the check, toJson and fromJson methods.
3. The check method runs when Pimcore evaluates conditions and must return a boolean, for example whether total cart weight exceeds the configured limit.
4. Admin settings for a custom condition require a JavaScript file loaded through an event listener registered in config/services.yaml.
5. The JavaScript function returns either the condition title for the dropdown or an Ext.form.FormPanel interface, with saved values passed automatically from PHP.

![Project folder tree with the MinWeightAmount condition class and interface under PricingManager](https://factory.dev/wp-content/uploads/2026/11/pimcore_admin_custom_conditions_php_files.png)

## **What you’ll learn with this guide**

In this short Pimcore guide, you’ll learn how to set any custom condition inside Pimcore’s pricing rules to fully adapt to any eCommerce need.

## **Where to use?**

If you’re looking to create new conditions upon which the prices change for every single customer, you’ll find this guide useful. With custom conditions, you have complete control over changes in pricing for every single customer.

## **Solution**

The pricing rules and conditions are defined in [yml file](https://github.com/pimcore/pimcore/blob/10.x/bundles/EcommerceFrameworkBundle/Resources/config/pimcore/config.yaml) on pimcore\_ecommerce\_framework inside pricing\_manager.

Default pricing rules and conditions are defined like this:

## **Creating a new pricing rule condition**

In this example, we are going to create min weight condition.

### **Step 1**

Create new directories in the ‘src’ directory

***src/Eccomerce/PricingManager/Condition***

### **Step 2**

Inside of that folder create 2 new files:

1. MinWeightAmountInterface.php
2. MinWeightAmount.php

![Project folder tree with the MinWeightAmount condition class and interface under PricingManager](https://factory.dev/wp-content/uploads/2026/11/pimcore_admin_custom_conditions_php_files.png)

### **Step 3**

Now open MinWeightInterface.php

The most important thing is that our class implements [ConditionInterface](https://github.com/pimcore/pimcore/blob/10.x/bundles/EcommerceFrameworkBundle/PricingManager/ConditionInterface.php) from Pimcore.

Since we created our interface for the MinWeightAmount class, we are going to extend Pimcore’s ConditionInterface.

**Pimcore’s ConditionInterface comes with 3 functions:**

1. check // This function is called by the Pimcore when checking if the condition is satisfied. And it expects boolean.
2. toJson // Used for serializing data on the frontend, expects string.
3. fromJson // Used for deserialize data for frontend. Expects ConditionInterface back.

We are going to **define two additional functions** in our interface:

1. setLimit // sets min weight limit
2. getLimit // returs min weight limit

Let’s see our file now:

Now let’s implement our worker class. We assumed here that each Product class will have a function called getWeight.

The most important function here is **check**. It will be called by the system upon checking all the conditions. There we iterated through all products in the cart and returned boolean if order weight is over the limit value which will be defined from the admin panel.

Now, we need to add our class to the config file, so let’s do it:

## **Admin UI**

To add special options to our admin UI, we need to add a new function to Pimcore conditions function.

### **Step 1**

First, create a new directory.

***public/static/admin/ecommerce/pricing-manager/conditions/min-weight.js***

### **Step 2**

Create a new file called min-weight.js

![Project folder tree with the min-weight.js file in the pricing-manager conditions folder](https://factory.dev/wp-content/uploads/2026/11/pimcore_admin_custom_conditions_js_file.png)

### **Step 3**

Now we need to include our js file into admin. It should be pretty much easy and straightforward.

You can find more info in Pimcore’s official documentation on [loading assets in admin UI](https://pimcore.com/docs/pimcore/current/Development_Documentation/Extending_Pimcore/Bundle_Developers_Guide/Loading_Admin_UI_Assets.html).

And now, we’ll need to add a new event listener to config/services.yaml.

Create a new folder called EventListener and create a new class called: PimcoreAdminListener.php

### **Step 4**

Now, let’s go back to the min-weight.js and build a UI.

## **Explanation**

The first line is the most important one. We are adding our condition as conditionMinWeightAmount is key to object conditions. We define its value as a function.

The function will be called to get the name (used for dropdown menu) and it will be called when creating UI.

So, the function returns either a title of the condition or UI as Ext.form.FormPanel

Data will automatically contain the limit value from our PHP class.

If we open the Pimcore admin now and create a new rule when we click the + icon inside the conditions tab, we should see at the bottom our newly created conditions inside the conditions tab.

![Pimcore Pricing Rules: test_gift rule with the custom Cart min weight amount condition set to 23](https://factory.dev/wp-content/uploads/2026/11/pimcore_admin_custom_conditions.png)

## **Does it work?**

If you’ve followed this guide closely, step by step, you should have no issue creating custom conditions inside Pimcore’s pricing rules. However, if you’re having any issues, feel free to [reach out to us](https://factory.dev/contact)!

## **Do you have more questions, or you’re having issues while implementing this? Reach out to us; we’ll be glad to help!**

## Related

[Pimcore guides &amp; How to **Pimcore Studio Setup Guide: Backend &amp; Infrastructure for Developers** Step-by-step overview of Pimcore Studio backend setup, including required services, DDEV configuration, bundle installation, indexing, and production considerations. 34 min read](https://factory.dev/pimcore-knowledge-base/tutorial/pimcore-studio-setup-guide-backend-infrastructure) [Pimcore guides &amp; How to **Customizing Pimcore Classification Store: Removing Grid View Duplicates and Simplifying DataHub Imports** Shared Classification Store attributes can clutter Pimcore grid views and make DataHub imports harder to maintain. This article shows how a custom implementation creates one logical attribute view… 10 min read](https://factory.dev/pimcore-knowledge-base/how-to/customizing-pimcore-classification-store) [Pimcore guides &amp; How to **Using named API routes in separated Vue CLI generated Applications** Discover how to use named, and exposed routes via Symfony FOSJsRoutingBundle in separated Vue CLI generated Applications. 2 min read](https://factory.dev/pimcore-knowledge-base/how-to/named-api-routes-in-separated-vue-cli-generated-applications)

---

Source: https://factory.dev/pimcore-knowledge-base/how-to/custom-condition-pricing-rules
