Questions tagged [sales-rule]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
41 views

Magento2 how to get two tables data in my custom grid.?

I want to get data as name from salesrule table code from salesrule_coupontable. Here I attached the salesrule and salesrule_coupon table in which I want to get code column data. In the salesrule ...
Ekta's user avatar
  • 101
0 votes
0 answers
14 views

SQL for getting promos applied to an order

I require an SQL query to retrieve information about the promotions applied to an order from the sales order table. The field "applied_rule_ids" is utilized to obtain all rule IDs. However, ...
Shiffin Thomas's user avatar
0 votes
0 answers
35 views

Coupon code is not validating the customer segment condition on cart page?

I have customer segment and sku condition in the cart rule with specific coupon code. This is working fine for sku condition but this is not working for exact customer segment id. Same coupon code is ...
Vinod Kumar's user avatar
  • 2,045
1 vote
1 answer
36 views

Magento 2.4 Restrict Apply Coupon code if cart has item with 0 price

In Magento 2.4, I want to create a cart rule and that can not be applied if any product in the cart with 0 price. For Example, I have created a coupon code that allows a 20% discount on the total of ...
Kishor Thummar's user avatar
0 votes
2 answers
138 views

Getting coupon codes from sales rule?

Magento 2.4.6 I creates a sales rule, lets say it has ID 123. I am loading it like this for now (yes, I know ObjectManager is bad practice): $objectManager = \Magento\Framework\App\ObjectManager::...
user4095519's user avatar
1 vote
0 answers
112 views

Coupon code is not saving at quote table in magento 2

I upgraded my website from 2.3.6-p1 to 2.4.5-p1 . After that when i applied the cart rule with coupon code, it shows the error that The coupon code "GHSDYFEWFCER" is not valid. When ...
jaisa2's user avatar
  • 15
4 votes
0 answers
79 views

Discount Calculation Issue Magento 2

I am facing an issue with the discount calculation. There are three coupon which are applied automatically without coupon code (coupon 3, coupon 4, coupon 5) and one more coupon code which i have ...
Sunny Rahevar's user avatar
0 votes
0 answers
98 views

Magento 2: How to use custom options in action apply field in cart price rule frontend

I have added two new option in admin cart price rule action apply section for give tier price discount based on apply rule in cart. Percent Discount: Buy Min N Products, Get Tiered Promotions Fixed ...
Kirti Nariya's user avatar
  • 3,461
0 votes
1 answer
40 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.
Fahim Ahmed Fahim's user avatar
1 vote
1 answer
212 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 ...
Harsh Patel's user avatar
0 votes
1 answer
515 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() ...
Jancy Abraham's user avatar
2 votes
1 answer
659 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 ...
Harsh Patel's user avatar
0 votes
1 answer
536 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. ...
Harsh Patel's user avatar
2 votes
1 answer
786 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\...
Harsh Patel's user avatar
0 votes
1 answer
147 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 ...
Claims's user avatar
  • 1,146
0 votes
1 answer
297 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
Krishnan Daiva's user avatar
0 votes
0 answers
480 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"?> <...
ishaq's user avatar
  • 183
0 votes
2 answers
306 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`.`...
Mohit Rane's user avatar
  • 1,935
0 votes
1 answer
336 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 ...
magento stacker's user avatar
0 votes
1 answer
280 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 ...
b41somp's user avatar
1 vote
1 answer
376 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 ...
Glen Runciter's user avatar
0 votes
1 answer
846 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\...
GenZ Dev's user avatar
  • 590
1 vote
1 answer
1k 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 ...
Milind Singh's user avatar
  • 1,584
2 votes
1 answer
532 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 ...
Mage2 Beginner's user avatar
0 votes
0 answers
102 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.
Chirag Gondaliya's user avatar
3 votes
0 answers
431 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 ...
jojo's user avatar
  • 179
0 votes
1 answer
722 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 ?
jojo's user avatar
  • 179
1 vote
0 answers
91 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?
MK Patel's user avatar
  • 422
4 votes
0 answers
222 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 ...
jojo's user avatar
  • 179
5 votes
1 answer
896 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 ...
Paul Donnelly's user avatar
0 votes
1 answer
602 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 ...
temper's user avatar
  • 984
0 votes
1 answer
366 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`.* ...
omsta's user avatar
  • 698
0 votes
1 answer
852 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::...
Hemangi Patel's user avatar
0 votes
1 answer
369 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.
LearnerElan's user avatar
0 votes
4 answers
466 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
Arjun's user avatar
  • 3,576
0 votes
2 answers
1k 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/...
Arjun's user avatar
  • 3,576