How to fix the ‘The WC_Cart::get_cart_url function is deprecated’ error in PHP

0 Comments

This error is mostly generated by outdated WordPress themes and/or plugins on sites which use WooCommerce.

After coming across it myself several times I finally found a good/simple fix on this page.

It says the offending code can be easily located by running the following command in your themes-folder:

grep -R -n "cart->get_cart_url"

Any occurrence of $woocommerce->cart->get_cart_url() & WC()->cart->get_cart_url() needs to be replaced with
wc_get_cart_url()

Was this answer helpful ? Yes (1) / No (1)

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

reduction