Magento2: Cart price rule has failed if use dropdown attribute

Created on 9 Aug 2017  路  13Comments  路  Source: magento/magento2


Preconditions


  1. magento ce 2.1.7 with sample data installed
  2. php 7.0.20
  3. MySQL 5.7

Steps to reproduce

  1. Create a new cart price rule
  2. Customer Groups select all
  3. Set Conditions

If total quantity greater than 2 for a subselection of items in cart matching ALL of these conditions:
-- Color is red

  1. set Actions

Apply: Percent of product price discount
Discount Amount: 10

  1. Save and Navigate to storefront as a guest
  2. Add 3 products with red color
  3. View cart and no discount

Test other attribute 8.11

  1. add new product attribute (text field type) eg: vendor
  2. add vendor to the default attribute set
  3. set vendor in product detail page. eg: addas
  4. update rule change color to vendor. eg: vendor is addas
  5. back to shopping cart and update
  6. it works

Expected result

buy a special color (red) and total greater than 2, have 10% discount

Actual result

no discount

screen shot 2017-08-12 at 00 59 59

Fixed in 2.2.x Fixed in 2.3.x Clear Description Confirmed Format is valid Ready for Work Reproduced on 2.1.x Reproduced on 2.2.x Reproduced on 2.3.x bug report

Most helpful comment

@vherasymenko are steps not clear from the screenshots?

All 13 comments

@minosss Thank you for your report.
If you want to report an issue please format this report according to the Issue reporting guidelines: with steps to reproduce, actual result and expected result.

@vherasymenko are steps not clear from the screenshots?

@vherasymenko updated, and the cart price rule works if use text field attribute.

screen shot 2017-08-12 at 01 09 59

@minosss, thank you for your report.
We've created internal ticket(s) MAGETWO-80211 to track progress on the issue.

I'm working on it #SQUASHTOBERFEST

Hi @marinagociu could you please accept the invitation to magento/magento2 repository ?

Hi @okorshenko can you please assign the task to me? @minosss is the reporter.

Reassigned

Thanks @okorshenko!

What I found investigating the issue is that for products subselections only the items that are visible in cart are checked against the specified conditions.
In the case described by the reporter, a configurable product was added to cart, and the condition specified on the subselection was based on the color attribute.
The rule was not applied because the configurable product has no value for this attribute since it's the one used to create it. So, I believe, the condition should have been checked against the selected simple product.

I also found that the same happens with bundle products, the conditions specified on subselections will only be checked against the bundle products, and not against it's children.

Is this the correct behaviour, that the conditions should be checked against the children of the visible quote items too?
Also, if this is the case, then for bundle products it would make more sense to use the quantity or the amount on the children items in order to calculate the total on the subselection, is this correct?

Hi @marinagociu,
For configurable product option attributes need to be checked on both parent and child products with the priority to the child values.
For Bundle it depends on Bundle type.

I tested the scenario and found that only product sub-selection condition doesn't work properly with colors. Product attribute combination condition works correct.

Hi @tkacheva,
I also encountered this issue only for the sub-selection condition. I will add a PR with a proposed solution.

The issue has been fixed and delivered to 2.2-develop branch. Will be available with 2.2.2 release

Hi @minosss. Thank you for your report.
The issue has been fixed in magento-engcom/magento2ce#1289 by @magento-engcom-team in 2.3-develop branch
Related commit(s):

  • b41594122f532f6a89165a70906a5b257562c0df
  • 7369261d82e0e5ad926eaf4ccb2a8def79c4fcbb
  • dce1c66301cdddfee2dc2887f584c333d0b438b2
  • 95ed67ee4adbbd7f3f0107a52da4b9238cf44803
  • 05fcdd1a52c674ea09a34960cea71e73488fbc99
  • 8b1a2972b3f0ddd4713d00055b8d60f737a72ce4
  • 90addb731c3b253d3da4dc564ddf94ac3525bd0f
  • d5c9eef075cd5f4d9781ec7f3151a14e087d061d
  • 6ec62717c16ed96d45e670d7f867b724f0449aaa
  • f0af87edad79b295b4be87f6f92502bacfbc2764
  • 2497062749bf41c80aaebb9b6cd21eb48656f58c
  • 1f7347f47cca48238f9deabd48a0a280bc0c309f
  • 0d151c41539ba7c4d20ede20d614bb4be257903c
  • 07982fdea19074788654c6e825874cb8188ab627
  • 617da6ca08607890779ce71530a2871438c88351
  • 39ed21f83071ebffd71963e9097ecb59fd906702
  • 9aa036dec42211867f68f714a746b71395c43bb2
  • fda37ef0af75e6b28d4a0da1781b19c7a7894a97
  • 47b109180b6b5e499ba8d82e6c67888fca21ffe8
  • ef6badace5c6b046047a6e5f617020f9d4410a82
  • 809ec050986fa3ddfeec4a715ce5ace1e41a4427

The fix will be available with the upcoming patch release.

Was this page helpful?
0 / 5 - 0 ratings