- This topic has 7 replies, 2 voices, and was last updated 3 years, 6 months ago by Tom.
October 17, 2017 at 12:52 pm #405154Arthur
I’m getting the following error for the
hrefvalue within the Cart Menu Item generated by GP:
<br /> <b>Notice</b>: WC_Cart::get_cart_url is <strong>deprecated</strong> since version 2.5! Use wc_get_cart_url instead. in <b>/.../public_html/staging/wp-includes/functions.php</b> on line <b>3831</b><br /> https://www.bigalstoybox.com/staging/cart/
I’m using WooCommerce 3.2.1 and WP 4.8.2.
Should this function be updated in the theme?GP Premium 1.4.3October 17, 2017 at 6:47 pm #405304TomLead DeveloperLead DeveloperOctober 18, 2017 at 6:25 am #405521Arthur
Tom, I only have GP Premium and WooCommerce active.
Do you think this is a PHP 7 or 7.1 error? I’ve tested this on 2 sites, both running on PHP 7.1, and I see the same error.October 18, 2017 at 6:50 am #405533Arthur
Tom, I tested the PHP versions and that is NOT the problem. Also, this error is only visible when using
I noticed the call on line 328 in the functions.php file for the GPP 1.4.3 plugin:
esc_url( WC()->cart->get_cart_url() )
It looks like the error Notice suggests using
wc_get_cart_url(). See this: https://docs.woocommerce.com/document/show-cart-contents-total/
Would this be the problem?October 18, 2017 at 4:29 pm #405895TomLead DeveloperLead Developer
Hmm, that’s strange. Your error specifically brings up this function:
That doesn’t exist in GP or GPP.
If you look at that example page you linked me to, they use this in their AJAX function (which GP uses):
That is the equivalent to
WC()->cart->get_cart_url(), which GPP uses.October 19, 2017 at 7:03 am #406250Arthur
WC()->cart->get_cart_url()in the functions.php file to
wc_get_cart_url()and the deprecation notice went away. I’m using the default WC AJAX functions (Enable AJAX add to cart buttons on archives) and the Menu Cart value still updates with AJAX using the
I was looking at the code from a standalone WC Cart Menu item plugin (which worked for me), and they used this
wc_get_cart_url()with a WC version check.
Is there any reason NOT to use that function?October 19, 2017 at 8:39 pm #406685TomLead DeveloperLead DeveloperOctober 26, 2017 at 10:37 am #410810
- You must be logged in to reply to this topic.