The "Total amount" inline condition has options to include, or exclude, different line item types (e.g. Product, Shipping).

This is excellent, but the generated Rule doesn't respect the settings here. If you inspect the rule, it has all line item types selected.

Steps to reproduce:

  1. Have a Commerce installation with product and shipping line items.
  2. Create an order discount with a condition that the Total amount for just products should be greater than £100: i.e. Products ticked, Shipping not ticked.
  3. View the generated rule's "Order amount comparison" condition: there all the line-item types are included in the total.
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

fonant created an issue. See original summary.

lexbritvin’s picture

Hello!

The issue is caused by a wrongly saved discount entity.
The discount entity has the following values for line item types condition:

Array(
    [commerce_coupon] => commerce_coupon
    [product] => product
    [shipping] => 0
)

When a rule is created/updated, only keys are checked and not the values and thus the rule contains all line item types.

I think, we need to filter empty values on discount save.
The patch is attached.

lexbritvin’s picture

Version: 7.x-1.0-alpha7 » 7.x-1.x-dev
Status: Active » Needs review