1

I want to add a custom column for "Installation Charges" inside cart items. This is going to be different installation charges for every product. I can pass that to cart using woocommerce_add_cart_item_data action hook. But how do I add the separate column to show these installation charges in cart?

Attached is a screenshot mockup of how it needs to be built.

enter image description here

1

Overwrite the WooCommerce template in your theme. The documentation for this can be found at https://docs.woocommerce.com/document/template-structure/

The file you're looking to overwrite is wp-content/woocommerce/templates/cart/cart.php

  • Thanks Jeffrey but I am actually working on a plugin, so not allowed to touch the theme files. Is there some action or filter hooks to achieve this? – aslamdoctor Apr 19 '17 at 9:25
  • Hmm... Based on the code of that file, there are not available hooks to alter the table columns. You could take a look at this old article from 2012 skyverge.com/blog/… basically meaning that themes can still override your file but if you tell them that you've done so in the plugin they can copy that instead and it should all be fine. – Jeffrey von Grumbkow Apr 19 '17 at 9:29
  • I just tried the method from old article but theme is already overriding the template files, so it's not working. – aslamdoctor Apr 19 '17 at 10:17
  • Well with that same method you can take away the check for WC templates in the theme and force it to only check in your plugin but then no one will use your plugin. It's simply not gonna happen ;) – Jeffrey von Grumbkow Apr 19 '17 at 11:42

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.