Fixing the Woocommerce Cart Template in Your Theme After WC 2.3+ Update

Updating from 2.1 or 2.2 – Now I have two Totals Tables in Cart

I know most people will already have fixed by now, but some people are still yet to update to 2.3 so this will no doubt help many of those, and thank fully it is a very simple fix.
All the magic happens in the .cart-collaterals div, in WC 2.2 you will see:

But in 2.3 the two functions below the call to do_action, were attached to the woocommerce_cart_collaterals action, and that is why they are done twice. So you make it:

If you are coming back from further than 2.2 you will also want to do the following:

CTRL+F for $woocommerce and you will find several things to change:

The first is:

Which becomes:

Then you have

Which you can make

Indeed for any instance of $woocommerce->cart you can change it to WC()->cart, this is not yet necessary due to backwards compatibility, but if you do it now it will save you problems in the future.

After you have done all those:

becomes

and that’s it – your done.

I have just done an update from 1.6.1 to 2.3.8 and I have more changes I have had to make in other templates, and also some plugin fixes. To make sure you don’t miss anything you should subscribe to the blog using the form upper-right.

If you have anything I have missed don’t hesitate to leave it in the comments.

Posted in Code Snippets, Help Topics, Plugins, Woocommerce, Wordpress and tagged , .

Leave a Reply

Your email address will not be published. Required fields are marked *