Constant wc_get_cart_url() error

  • 25 March 2021
  • 5 replies

Badge +2


I have the following issue: no matter what I do, I get a constant wc_get_cart_url() related error from the Klaviyo WooCommerce module and the error log reads: 

PHP message: PHP Fatal error:  Uncaught Error: Call to undefined function wc_get_cart_url() in /wp-content/plugins/klaviyo/includes/wck-cart-functions.php:94

Has anybody seen something like this? 




Best answer by hristolaskov 27 April 2021, 15:19

View original

5 replies

Userlevel 1
Badge +2

Hi @hristolaskov 


Sorry to hear you’re having trouble with the Klaviyo plugin. Can you please tell me what version of Klaviyo’s plugin you have installed? Additionally, what version of Woocommerce? Are you using Wordpress’ multisite feature?




Badge +2

Helo @Scott - no drama, I just want to fix the issue. 

So, I am running a multisite on WordPress 5.7, WooCommerce 5.1.0. and Klaviyo plugin v. 2.4.0 - but the problem is even before that, honestly speaking - since for ever. 

Userlevel 1
Badge +2

Thanks @hristolaskov , I suspect this is related to multisite. Klaviyo’s plugin was never built to be compatible with multisite Wordpress instances. Let me test this a little further to try and re-create the issue and, if able, we can hopefully update our plugin to resolve this issue.




Userlevel 7
Badge +61

Hi @hristolaskov.

Thank you for posting your question to the Klaviyo Community and thank you Scott for looking into this.

@hristolaskov, I was able to see that your issue did resolve. Would you mind sharing the solution you discovered? We know there are lots of other business owners and brand builders who may have similar questions in the future, so it's incredibly helpful when you share what you learn!

Thanks and have a great day.

Badge +2

Sure thing, yes, sorry for not responding earlier. 

So, based on Scott’s help, we added a checked whether the wc_get_cart_url() is actually defined (we know it is, yet sometimes it seems it is not recognized) . This stopped the errors, and yet - everything is functioning properly.

The edit is in wck-cart-functions.php, line 88:

if ( is_admin() || ! function_exists( 'wc_get_cart_url' ) ) { return; }