0

I am selling furniture, I also sell furniture accessories.

Both of these have their own Product Types.

I use 'Commerce Discount', 'Commerce Discount Extra' and a 'Workflow Rule' to offer a 20% discount on the accessories, but only when an item of furniture exists in the cart.

This rule composes of:

  • EVENT: Calculating the sell price of a product.
  • CONDITIONS:
    • Product Types: Furniture Accessories AND
    • Order Contains Products: [a list of SKUs of every furniture item I sell]
  • ACTIONS: [The name of the discount I set up in 'Commerce Discount'] (which applies the 20% discount on any 'Furniture Accessory' products)

My problem is:

As soon as I add a piece of furniture to my cart, any furniture accessory product display price is discounted across the site. I'd like the prices to remain at full price when viewing the product display node, but only discounted once viewing the cart or the checkout process is underway.

It feels like their should be another Event, perhaps "Starting the checkout process" or "Viewing the cart"

1
  • Hi, please keep it to one question per post and remember that requesting module recommendations is off topic here. Thanks!
    – Clive
    Jan 7, 2019 at 16:03

1 Answer 1

1

When product sell prices are calculated via Rules, they are done so in the context of either a temporary line item (for products not in the cart) or the line item on an order (for products in the cart). This means you can check to see if the commerce-line-item:line-item-id is empty or not using something like the "Data value is empty" condition. In your case, you'd want to negate that condition so that if the line item ID is empty, the discount is not applied.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.