Questions tagged [sales-rule]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
33 views

I am new in magento! :: I have task to add a custom field('is_vip') in order columns. please help me?

Programatically, add a custom field('is_vip') in order. If a customer order value over $150 , the field value will be 1 and in order grid it will show yes.
0 votes
1 answer
65 views

how can discount apply on another product Y based on X Product Step Qty

I need to apply discount on another different product Y based on X Product Step Qty. So that why I was created custom simple action in sales rule. I created custom action class for calculation ...
0 votes
1 answer
69 views

Magento 2 How to Get List Products from Cart Price Rule Condition

I want to get the cart price rule applicable products list in my block. How can I get it? For catalog rule, at vendor/magento/module-catalog-rule/Model/Rule We have the method getMatchingProductIds() ...
1 vote
1 answer
163 views

How to validate a custom field in sales rule before the discount applying to cart in magento 2.4

I created three custom fields in salesrule Database Table. apply_on_weekday applicable_time_from applicable_time_to Now I wants to validate that custom fields before the applying the cart price rule ...
0 votes
1 answer
141 views

multiselect custom field does not save in sales rule admin form in magento 2.4

I need to save custom multiselect field value in the apply_on_weekday column which is located in the salesrule Db table. I tried a lot but it doesn't save the data in the database. Below is my code. ...
1 vote
1 answer
196 views

How to save extension attribute in Salesrule Api magento 2.4

I need to save custom field data in apply_on_weekday column which is located in salesrule DB table. I tried too much but it doesn't save it in DB. I share my code below. vendor\Module\etc\...
0 votes
0 answers
41 views

Create Sales Rule With Subtotal condition

I know how to create a sales rule. But i'm failing to add this rule a condition based on the subtotal Which means i Want to reproduce this programmatically I see this is added into the salesrule ...
  • 1,004
0 votes
0 answers
24 views

Remove Cart Price Rules with type No Coupon

I create a cart price rule with coupon type is No Coupon. I don't wanna change its condition in admin, how can I remove this rule by code? I override function applyRules in module Magento_SalesRule (...
0 votes
1 answer
95 views

Why Magento not supporting cart price rule per store

Why Magento does not support storeview level sales rules? Is there any way we can create shopping cart price rules based on store-views? Discount should apply only for particular store views
0 votes
0 answers
191 views

Add custom data to SalesRule API

I tried to add custom data to SalesRule through the endpoint V1/salesRules but ended up with getting error My code is below 1- etc/extension_attributes.xml <?xml version="1.0"?> <...
  • 141
0 votes
1 answer
117 views

Magento 2 Error while canceling the order

I'm facing the below error while canceling the order SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`magentodb`.`...
  • 1,905
0 votes
1 answer
161 views

How Does magento sales rule validate date and apply rule only if it is within range date

I was looking in to core module for sales rule but was unable to find the logic where it actually apply the filtration of current date and date added in rule that is From and To. If i have created 3 ...
0 votes
1 answer
115 views

Where is row_id column definition in magento module-sales-rule module source code?

I looks at salesrule table source code in Magento 2.3.3 vendor/magento/module-sales-rule/etc/db_schema.xml. In that file, it said the table primary key is rule_id column but actually the primary key ...
1 vote
1 answer
201 views

Using Subtotal as condition for sales rule is not working in Magento 2.2.6

I have a sales rule that has these conditions. I have to apply a discount if the cart contains at least one product of one of these categories and if the subtotal is more than 25 euro. The rule works ...
0 votes
1 answer
608 views

Magento 2: Get attribute at which coupon condition fails and show it in a message

I need to show custom coupon error messages on frontend based on conditions.Where does the validation of coupon occurs when customer applies a coupon on the checkout page? As far as I know, Magento\...
  • 580
1 vote
1 answer
809 views

Is there any way to get all Applied Discount (for cart rules and coupons) line items in cart/order in Magento 2?

I need to show all cart/order discounts in the following manner: Subtotal ----------- 100.00 CHRISTMAS10 (Christmas Sale 10 % off) ----------- -10.00 CHDLL1242DK (Coupon ...
  • 1,522
2 votes
1 answer
379 views

How to add sales rule action fieldset in customer group area

I want to add sales rule fieldset to customer group form using custom module. can any one please guide me on this how to add this sales rule condition form under customer group edit form and save this ...
0 votes
0 answers
86 views

Magento 2 add custom discount before cart rule discount in checkout

Here we add custom discount but here the problem is I want a custom discount to calculate before a cart rule. But here first calculate cart rule then my custom discount.
3 votes
0 answers
380 views

Product grid checkbox input at sales rule form Magento 2 not working

I'm using Magento 2.3.4 and want to add product grid with checkbox as an input for sales rule form (shopping cart price rule), i follow the instruction to add product grid input from here but when I ...
  • 89
0 votes
1 answer
483 views

Magento 2 salesrule obsersver save after & before

In Magento 1.9 i have an observer salesrule_rule_save_before and salesrule_rule_save_after for the backend area, are there any equivalent observer like this in Magento 2 ?
  • 89
1 vote
0 answers
69 views

Magento 2 how to add customer chooser in cart price rules condition

I want to add customer chooser in cart price rules conditions like category and product chooser. Can anyone help me with this?
4 votes
0 answers
182 views

Data migration Tool sales rule actions and condition serialized

I'm using Magento Data migration tool to migrate Magento 1.9.3 to Magento 2.3.4, everything went fine until I check the log error when I went to checkout page, I found out that in sales_rule table ...
  • 89
5 votes
1 answer
491 views

Custom Cart Rule Action Condition in Magento 2

I have a custom quote item attribute (v_code) and I want to use this when creating a cart sales rule. Scenario: If a cart item has a v_code, it's included/excluded from the discount. I've managed to ...
0 votes
1 answer
443 views

Magento 2 get Store Id of a coupon code programmatically

I am using multiple stores, I wanted to get all the coupon code of a particular store. In Magento 2 database, salesrule_website table have stores related information, but their is no model/collection ...
  • 954
0 votes
1 answer
308 views

Magento 2: SQL error when redeeming coupon code

Magento 2.2.9 When I try to redeem a coupon code I get an SQL error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'rule_coupons.expiration_date' in 'where clause', query was: SELECT `t`.* ...
  • 628
0 votes
1 answer
724 views

Cron Job ebizmarts_ecommerce has an error: in magento2

I have uploaded ebizmarts_ecommerce module in my live server. Cron Job ebizmarts_ecommerce has an error: : Argument 1 passed to Magento\SalesRule\Model\Converter\ToDataModel::...
0 votes
1 answer
326 views

How to Get List of Coupons Available for Customer Using REST API

I need to get the List of Coupons Available for Logged in customers using REST API.
0 votes
4 answers
261 views

How can I override following file?

In the above attach file I want to change Magento\SalesRule\Model\Rule\Condition\Address to Company\SalesRule\Model\Rule\Condition\Address
  • 3,476
0 votes
2 answers
999 views

How to override validate() of module-sales-rule/Model/Rule/Condition/Address.php?

I want to override validate() function of this file vendor/magento/module-sales-rule/Model/Rule/Condition/Address.php in my custom module file app/code/Companyname/Subtotalwithdiscount/Model/Rule/...
  • 3,476