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.
By JoeWeb01 on
Hello,
I'm wondering if there is an easy way to add an optinal field in a Commerce Cart (eg. insurance).
Actually it's an optional field with a custom price (10% of the total price) so it must be updated and must only be check or not in the cart. This is a little bit like the cancellation insurance for a flight that you can check in the checkout panel or in the cart.
I saw a lot of possiblities (add-on, attributes, ...) but I don't find a way (via a module) to add this kind of feature.
Does someone already find a way to do that?
Regards,
Comments
~
I would use https://www.drupal.org/project/commerce_fees
Put a Boolean field on your checkout page, then in your fee condition look for the new field. I haven't tried this but it may work.
It seems a good way but I
It seems a good way but I don't know how to add a custom field (in this case a boolean) in the shopping cart view.
I created a boolean field in the order (because this is related to the full order) but I cannot add it in the shopping cart view. Actually it's possible to add a field in the line item but not directly in the shopping cart.
The idea is to add it in the shopping cart to calculate the price once the user click on the checkout button. But maybe I miss something...
Actually I used the module
Actually I used the module Commerce Cart Pane and it made the work!
I created a custom pane with a checkbox to set the fee or not.