Magento 2 add shipping price in condition on cart price rule

This blogpost provide you with the small code to add shipping price in condition on cart price rule. Sales price rule condition are in sales-rule module and can be found in below mentioned file

module-sales-rule\Model\Rule\Condition\Address.php

In this file you need to add a condition in loadAttributeOptions() function for shipping_amount as shown in below code:-

 $attributes = [
            'base_subtotal' => __('Subtotal'),
            'total_qty' => __('Total Items Quantity'),
            'weight' => __('Total Weight'),
            'payment_method' => __('Payment Method'),
            'shipping_method' => __('Shipping Method'),
            'postcode' => __('Shipping Postcode'),
            'region' => __('Shipping Region'),
            'region_id' => __('Shipping State/Province'),
            'country_id' => __('Shipping Country'),
            'shipping_amount' => __('Shipping Price'),
        ];

see the images below:-

Leave a Comment.