Guests can add a meal plan to their cart. They can compose their own formula. Type of sandwich, drink and dessert.

For example the list of drinks is a list of 'taxonomy' terms. However some drinks can give a supplement. For example the formula costs 1 € more if I take a coke.

I do not know how to do this possibility. I had imagined adding a field in the taxonomy of drinks where we can put the blow of the supplement. But I did not find with Rules how to add this extra to the cart.

Have an idea of ​​how I could do it? Thank you for your help


We've covered this concept before in our "pizza store" tutorial, though it appears the video may not be online any more: https://drupalcommerce.org/videos/tutorials/customizable-products-pizza-store

The steps would be the same, though. I'd basically add a price field to the taxonomy vocabulary and then include the upcharge in the price field for the options the customer is selecting. Rather than using this taxonomy as a product attribute, you'd put it on the line item type as a custom line item field. Then you'd create a pricing rule that evaluates the fields on the line item type to look for a value in the upcharge price field and adds that amount to the unit price of the line item.

This is about as in depth as I can go on StackExchange. To learn how to use any of those particular features outside of getting this recipe, you should find real-time support at a local meetup or else in the Drupal Slack #commerce channel.

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.