Creating custom condition

To create a custom condition you will need to create 2 files in these folders:
You can base your custom condition on something that already exists. For example, try to copy these 2 files:
And rename those to something else, following the naming scheme, for example:
Conditions are mostly what is presented in the UI, but it also can have the code to get the value. Condition methods are what drives the conditions comparison.
To correctly set those up, you will need to set the key for each and link them via options in the beginning of the file:
protected $key = 'coupons';
protected $contexts = array('product_pricing', 'cart_discounts', 'checkout_fees');
protected $method = 'coupons';
As you can see there's $method variable, which points to the specific method.
Also, in the condition you will see get_value() and get_label() methods - those you can change however you want. In condition method you will need check() method, which will control how the pre-defined condition value is compared to the actual value in each case.
Have more questions? Submit a request