WooCommerce: Remove Product Links @ Cart Page

We’ve already seen how to remove the product permalink from the “order table” (the one you see on the Thank you page, My account pages and emails). Thsi time, we’re looking at doing the same thing on the Cart page, which uses different “hooks” than the order pages and therefore requires its own snippet.

Here’s how it’s done – as usual 1 PHP line is sufficient!

How to delete the Cart item permalink

PHP Snippet: Delete Cart Item Permalink @ WooCommerce Cart

 * @snippet       Remove Cart Item Link - WooCommerce Cart
 * @how-to        Get CustomizeWoo.com FREE
 * @sourcecode    https://businessbloomer.com/?p=80927
 * @author        Rodolfo Melogli
 * @compatible    WooCommerce 3.4.7

add_filter( 'woocommerce_cart_item_permalink', '__return_null' );

Where to add custom code?

You should place custom PHP in functions.php and custom CSS in style.css of your child theme: where to place WooCommerce customization?

This code still works, unless you report otherwise. To exclude conflicts, temporarily switch to the Storefront theme, disable all plugins except WooCommerce, and test the snippet again: WooCommerce troubleshooting 101

Related content

  • WooCommerce: How to Fix the “Cart is Empty” Issue
    For some reason, sometimes you add products to cart but the cart page stays empty (even if you can clearly see the cart widget has products in it for example). But don’t worry – it may just be a simple cache issue (and if you don’t know what cache is that’s no problem either) or […]
  • WooCommerce: “You Only Need $$$ to Get Free Shipping!” @ Cart
    This is a very cool snippet that many of you should use to increase your average order value. Ecommerce customers who are near the “free shipping” threshold will try to add more products to the cart in order to qualify for free shipping. It’s pure psychology. Here’s how we show a simple message on the […]
  • WooCommerce: Cart and Checkout on the Same Page
    This is your ultimate guide – complete with shortcodes, snippets and workarounds – to completely skip the Cart page and have both cart table and checkout form on the same (Checkout) page. But first… why’d you want to do this? Well, if you sell high ticket products (i.e. on average, you sell no more than […]
  • WooCommerce: Weight-Based Shipping Methods
    With WooCommerce you get 3 default shipping methods: Flat Rate, Free Shipping, Local Pickup. For each one you can define a cost, however there is no way to set up some “weight” restrictions. So, what if you want to display a rate for orders below 10 kg, and another shipping rate for orders above that […]
  • WooCommerce: Hide Shipping Method If Shipping Class Is In The Cart
    Our goal is to check if a Product with a specific Shipping Class is in the Cart, and consequently disabling a shipping rate such as Free Shipping if this is true. This is super useful when there are multiple items in the cart and you don’t want to give free shipping for certain orders for […]

Rodolfo Melogli

Business Bloomer Founder

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as an independent WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza. Follow @rmelogli

16 thoughts on “WooCommerce: Remove Product Links @ Cart Page

  1. When I do this it does indeed remove the link but it also makes the text white, even though I have links set to a blue color. I can’t find a workaround for this, please help!

    1. Sounds like a CSS issue to me

  2. Thanks for posting. Still works in august 2022.

  3. Remove Product Title Permalink for Email Notifications. How do i do that?

  4. Still working perfectly!
    Thank you soooo much!!!

    1. Great!

  5. Hi! This does not work for me – maybe because I we are using built-in attributes. After adding this add_filter to functions.php the product links are still there in the cart, example: /shop/traffic-signs/advisory-speed/?attribute_pa_size=45x45cm&attribute_pa_sub=steel-16-guage&attribute_pa_reflct=engineer

    I’m actually trying to eliminate the additional variables (starting at ?) and keep the product URL, example: /shop/traffic-signs/advisory-speed/

    Not having any luck – been searching for hours.

    1. Sounds odd. Disable all plugins but Woo and switch theme – does the snippet work?

  6. Still works, you are brilliant. Thanks so much.

    Btw I need to use Code Snippets tool for it to work.

    1. Ok thank you

  7. Still works. Thanks.

    1. Awesome

  8. Hi, how can we do that only for some products? forexample on my case I am trying to hide wp job manager listing type product from market(shop) and want to users if purchase some listing type its add to cart a product and this product coming to viewable. I just dont want that products viewable. there is a way to configurate this product id?

    1. Hey Ongun, thanks for your comment! I suggest you take a look at “conditional logic”: https://businessbloomer.com/conditional-logic-woocommerce-tutorial/ and https://businessbloomer.com/woocommerce-conditional-logic-ultimate-php-guide/. Let me know ๐Ÿ™‚

Questions? Feedback? Customization? Leave your comment now!

If you are writing code, please wrap it like so: [php]code_here[/php]. Failure to complying with this, as well as going off topic or not using the English language will result in comment disapproval. You should expect a reply in about 2 weeks - this is a popular blog but I need to get paid work done first. Please consider joining the Business Bloomer Club to get quick WooCommerce support. Thank you!

Your email address will not be published. Required fields are marked *