3

I'm using the commerce module to show product in a site.

I need to create a rule on the event of Calculating the sell price of a product which should involve removing products from the cart in a given condition.

I see that there is an action to Add a product to the Cart. But how do I remove a product from the cart?

Should I use the Remove from list action?

enter image description here

5

Check what rszrama, the Drupal Commerce leader, says about this:

If you find and delete the line item, it should work just fine. You can do this with the "Delete entity" action. You could also just unset the price of the line item you want deleted during "Calculating the sell price of a product." That's what the "Unset the price of disabled products in the cart" default rule does, so you can refer to it for an example. Unsetting the price just involves setting the amount to NULL (i.e. no value, not 0).

http://drupal.org/node/1267156#comment-4937288

  • Thanks, I've trying for a long time. The Delete Entity action worked perfect! :) – Diego Jancic Feb 18 '14 at 23:03
1

Another way of doing this is to follow RFay's great video on using a component and looping. This method can be combined with Commerce Rules Extra to build a lot of complex business workflows for your cart.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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