Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Once a line item of a non-product line item type is added to the cart (e.g. a shipping line item), evaluation of the "Sum quantities for products sharing a display" action fails and the price is no longer calculated correctly.
Relevant extract from rules debug log:
- 0 ms Rule Override price with price table fires.
- 0.076 ms Evaluating the action commerce_price_table_sum_quantities. [edit]
- 12.31 ms Unable to get a data value. Error: Unknown data property commerce_product.
- 2281.182 ms Unable to evaluate action commerce_price_table_sum_quantities. [edit]
- 2281.819 ms Unable to get variable combined_product_sum, it is not defined.
- 2282.299 ms Unable to evaluate action commerce_price_table_set_price. [edit]
- 2282.339 ms Rule Override price with price table has fired.
Steps to reproduce:
- Make sure, that the cart is displayed on the review page of the checkout process.
- Create a new order for a product and a quantity, so that an alternative sales price is used.
- Make sure, that a line item of a non-product line-item type is added to the order before you reach the review page, e.g. a shipping line item.
Actual result
The "Sum quantities for products sharing a display" action will fail to evaluate and thus, the price shown in the cart on the checkout review page is not calculated correctly.
Expected result
The "Sum quantities for products sharing a display" action is evaluated. The price shown in the cart on the checkout review page is calculated correctly.
Proposed fix
Skip non-product line items in "Sum quantities for products sharing a display" action.
Comment | File | Size | Author |
---|---|---|---|
#3 | commerce-price-table-2803613-03-sum-quantities-action.patch | 785 bytes | FeyP |
Comments
Comment #2
FeyP CreditAttribution: FeyP at werk21 commentedAttached is a patch against 7.x-1.x-dev
Comment #3
FeyP CreditAttribution: FeyP at werk21 commentedUnfortunately, there was a small mistake in my previous patch. This time it should work correctly.
Comment #4
kscheirerSeems pretty sane.
Comment #6
Alex Liannoy CreditAttribution: Alex Liannoy at ZANZARRA Drupal Agency commentedHi guys,
Thank you for committing and reviewing the patch.
Now, 2 years later, I am pushing it to the dev branch :)
Thank you for your patience.