Compatibility Weglot, cart url
-
Hello OceanWP team,
It’s Remy, the CTO of multilingual plugin. I’ve recently come across a small bug that when you are in a translated language, for example when you are on mywebsite.com/fr/ then small cart icon in the menu still have the link /cart instead of /fr/cart
It’s funny because then, in the cart popup, the button “View Cart” has the correct link /fr/cart
So I had a closer look to know why and found out the reason :
– For the cart link on the small cart icon, you use directlyget_permalink( $cart_id )
so it doesn’t trigger hooks.
– For the cart popup, button “View Cart”, you use :wc_get_cart_url()
With this, Weglot hooks that adds the /fr/ is called correctlyMy suggestion is to modify file woocommerce-helpers.php, line 49. Change
$url = get_permalink( $cart_id );
by
$url = wc_get_cart_url();
It should fix the issue.
- The topic ‘Compatibility Weglot, cart url’ is closed to new replies.