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        businessbloomer.com/woocommerce-customization
 * @sourcecode    https://businessbloomer.com/?p=80927
 * @author        Rodolfo Melogli, Business Bloomer
 * @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

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 *