Echoing the_permalink on a woocommerce product in the cart page will create a link with the attribute selection included in the link such as this:
http://ourdemo.com/product/product-test-2/?attribute_pa_frame=polished-chrome
We want to take these attributes out of the link (for various reasons), however it seems the_permalink, when run on the product id will return them automatically.
Looking at the documentation i cannot seem to find a parameter to not return the attributes? Is there another way to get the base permalink without any parameters?
Thanks
The trouble is that
$_product->get_permalink($cart_item)
automatically adds the attributes to the permalink whenever the product in question is a variation.I don’t understand why you’d want to get rid of that behavior, but it can be accomplished by switching the
$_product->get_permalink()
method to WordPress’ defaultget_permalink()
function. For non-variation products, the method is just a “wrapper” anyway.If you aren’t showing thumbnails, then you can switch the title link via filter:
If you are showing the thumbnails in the cart, then I think you will need to override the
cart/cart.php
template and modify the references$_product->get_permalink( $cart_item )
to
get_permalink( $cart_item['product_id'] )