I want to create an option for my customer that they can select for insurance that will cost 65 cents for every 100$ they spend for the entire order.

Keep in mind I only want to give the option to insure everything not individual items.


Sounds like something that could better be implemented as a custom total than as a separate product.

I won't go into detail with how to do that, you will find tutorials such as http://excellencemagentoblog.com/blog/2012/01/27/magento-add-fee-discount-order-total/

The collect method can add the insurance fee based on the subtotal.

So far it is pretty standard. But you want the customer to choose if they want insurance or not. I would implement this similar to discount codes:

  • new quote attribute "has_insurance"
  • a form on the cart page
  • a custom controller for this form that sets the new attribute, then redirects back to the cart
  • in the custom total, only add the insurance fee if has_insurance=1

Note that on every page load on the cart, the totals are recalculated without further ado.

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.