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 PHP snippets at the bottom of your child theme functions.php file and CSS at the bottom of its style.css file. Make sure you know what you are doing when editing such files - if you need more guidance, please take a look at my guide "Should I Add Custom Code Via WP Editor, FTP or Code Snippets?" and my video tutorial "Where to Place WooCommerce Customization?"

Does this snippet (still) work?

Please let me know in the comments if everything went as expected. I would be happy to revise the snippet if you report otherwise (please provide screenshots). I have tested this code with Storefront theme, the WooCommerce version listed above and a WordPress-friendly hosting.

If you think this code saved you time & money, feel free to join 17,000+ WooCommerce Weekly subscribers for blog post updates and 250+ Business Bloomer supporters for 365 days of WooCommerce benefits. Thank you in advance!

Need Help with WooCommerce?

Check out these free video tutorials. You can learn how to customize WooCommerce without unnecessary plugins, how to properly configure the WooCommerce plugin settings and even how to master WooCommerce troubleshooting in case of a bug!

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.

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? Support? Leave your Comment Now!

If you are writing code, please wrap it between shortcodes: [php]code_here[/php]. Failure to complying with this (as well as going off topic, not writing in English, etc.) will result in comment deletion. 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 BloomerArmada to get blog comment reply priority, ask me 1-to-1 WooCommerce questions and enjoy many more perks. Thank you :)

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