WooCommerce: Remove Link to Product @ Order Table

There is a slightly annoying thing on the WooCommerce Thank-You Page and WooCommerce emails. Users looking at the order table can actually click on the Products they just purchased and abandon the page before taking the action you want them to take (see image below).

So, I coded a simple PHP snippet to remove such links. As usual, 1 line of code is more than sufficient:)

The annoying hyperlink to the product on the WooCommerce order table
The annoying hyperlink to the product on the WooCommerce order table

PHP Snippet: How to Remove the Product Permalink @ WooCommerce Order Table

/**
 * @snippet       WooCommerce Remove Product Permalink @ Order Table
 * @how-to        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @testedwith    WooCommerce 4.3
 * @community     https://businessbloomer.com/club/
 */

add_filter( 'woocommerce_order_item_permalink', '__return_false' );

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: Add Content to a Specific Order Email
    Customizing WooCommerce emails via the WordPress dashboard is not easy and – sometimes – not possible. For example, you can’t edit or add content to them unless you’re familiar with code. Well, here’s a quick example to learn how to add content to any WooCommerce default order email. In this case study, our goal is […]
  • WooCommerce: Redirect to Custom Thank you Page
    How can you redirect customers to a beautifully looking, custom, thank you page? Thankfully you can add some PHP code to your functions.php or install a simple plugin and define a redirect to a custom WordPress page (as opposed to the default order-received endpoint). This is a great way for you to add specific up-sells, […]
  • WooCommerce: How to Add a Custom Checkout Field
    Let’s imagine you want to add a custom checkout field (and not an additional billing or shipping field) on the WooCommerce Checkout page. For example, it might be a customer licence number – this has got nothing to do with billing and nothing to do with shipping. Ideally, this custom field could show above the […]
  • WooCommerce Visual Hook Guide: Emails
    WooCommerce customizers: the Visual Hook Guide is back! Here’s a visual HTML hook guide for the WooCommerce Emails. This visual guide belongs to my “Visual Hook Guide Series“, that I’ve put together so that you can find WooCommerce hooks quickly and easily by seeing their actual locations. Let me know in the comments if this […]
  • WooCommerce: Remove Add Cart, Add View Product @ Shop Page
    A fan requested an interesting edit on the Shop/Category page (or “loop”). Instead of having the default “Add to Cart” button, they wanted to remove that and substitute with a “View Product” button link to the single product page. Here’s the simple snippet – enjoy!

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

53 thoughts on “WooCommerce: Remove Link to Product @ Order Table

  1. Hey Rodolfo Is this solution still working in 2022? looking for it

    1. Hey Hu, did you test it?

  2. That is great, do you have any idea to remove links in the meta (wc-item-meta) that some plugins add bellow the product name?
    Trying to remove emails (mailto) links with no sucess

    1. Hi Mario, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

  3. Thank you for your tips and ideas. Much appreciated!

  4. So with this:

    /* Remove product link at checkout */
      
    add_filter ( 'woocommerce_cart_item_permalink' , '__return_null' ) ;  
    
    /* Remove product link on order overview */
      
    add_filter ( 'woocommerce_order_item_permalink' , '__return_false' );
    

    The first one works but the second one does not in Woo 4.3.1 and WP 5.4.2…

    1. Weird. Does that also happen with a different theme and no plugins but Woo?

      1. anybody ever figure out a fix for this? It doesn’t work for me either -I’m running the latest version of woo:

        /* Remove product link on order overview */

        add_filter ( ‘woocommerce_order_item_permalink’ , ‘__return_false’ );

        1. Upon further review, I think your snippet does work. I had another filter further back on functions.php that was conflicting with it.

          1. Excellent

            1. Hello,

              The snippet is working to remove the link to product in order table. I wish to remove the link to product in download table too. Do you have idea the code that remove the link to product in download table?

              1. Hello KF, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

  5. How about if want also to remove product permalink in account bookings?

    1. Hey Edgar, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

  6. Hello, if there is any possibility to delete such permalink, but on the “Shop Order” level? I mean this one, when you add some products to the cart, then you click “Proceed to checkout” and you are on this page. You can enter your ship address etc.

    Thank you much in advance!

    1. Screenshot please?

  7. This worked great but I also want to remove the link to the product page from the download table since cleints always click it instead of the download button. I can see it in the order-downloads.php here

     <?php foreach ( wc_get_account_downloads_columns() as $column_id => $column_name ) : ?>
    					<td class="<?php echo esc_attr( $column_id ); ?>" data-title="<?php echo esc_attr( $column_name ); ?>">
    						<?php
    						if ( has_action( 'woocommerce_account_downloads_column_' . $column_id ) ) {
    							do_action( 'woocommerce_account_downloads_column_' . $column_id, $download );
    						} else {
    							switch ( $column_id ) {
    								case 'download-product':
    									if ( $download['product_url'] ) {
    										echo '<a href="' . esc_url( $download['product_url'] ) . '">' . esc_html( $download['product_name'] ) . '</a>';
    
    

    as the “echo ‘<a href="' . esc_url( $download['product_url'] "

    but I don't know how to disable it.

    Can you help me please! thanks

    1. Hi Brenden, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

      1. Change it to this 😉

        	switch ( $column_id ) {
        								case 'download-product':
        									echo esc_html( $download['product_name'] );
        									break;
        								case 'download-file':
        
        1. Lol, thanks!

  8. Works great, thank you!
    > WordPress Version 5.2.3 and WooCommerce Version 3.7.0

    1. Cool!

  9. Hello, this snippet work again ?

    1. It should – can you test it and let me know?

      1. Yes it works on wordpress 5.2.2

  10. Hi
    I am using store front child theme and there is no link to product title on checkout page. so how can i add link there ? obvioulsy its my reverse question then your code snippet.

    Thanks
    Ahir

    1. Hello Ahir, thanks so much for your comment! Yes, this is possible – unfortunately this is custom work and I cannot provide a complementary solution here via the blog comments. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding! ~R

  11. Can this code be adapted to remove the product page link in the “order completed” email? At present the one link is to the product page and another is to the download. Customers of course click on the first link!

    1. Hello Bodhi, thanks so much for your comment! Yes, this is possible – but unfortunately this is custom work and I cannot provide a complementary solution here via the blog comments. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding! ~R

  12. When using WC Subscriptions, the thank-you page also has a section titled “Related subscriptions” where the first column is labeled “Subscription” and links to the subscription. Any help getting this snippet to work for that, too? Thanks!

    1. Hello Will, thanks so much for your comment! Yes, this is possible – but unfortunately this is custom work and I cannot provide a complementary solution here via the blog comments. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding! ~R

  13. Ciao Rodolpho,
    This snippet doesn’t appear to be working in WC 3.5.0 and WP 4.9.8

    Nice warm weather today! 🙂

    1. Hey Andrew, thanks for your comment! I’ve updated the snippet – let me know if this new version works 🙂

    2. Thanks for the help Rodolpho. I didn’t get a notification that you’d replied to this comment BTW. I just happened to have this tab open still and saw it this morning. The new snippet didn’t work either. I edited the functions.php file, tried it in Opera with the VPN function turned on and in a private window and the link to the cart contents was still active. I’m pretty sure it’s not something I’m doing wrong. The only thing I can see is that there’s no function in the new snippet, just the filter. Maybe that’s the problem or did WC just get less wordy?

      1. It works with me – so you have some conflict. Temporarily switch theme and disable every plugin but Woo – does the snippet work?

    3. Oh man that sounds like a struggle. I think the end result is a good idea but it’s not worth that much effort … yet 🙂 Thanks for your help though sir.

  14. Thanks Rodolfo, I’m getting an error in my logs: CRITICAL Uncaught ArgumentCountError: Too few arguments to function remove_permalink_order_table(), 2 passed in /wp-includes/class-wp-hook.php on line 286 and exactly 3 expected in /wp-content/themes/theme-child/functions.php:114
    What would you do to fix this please? Many thanks.

    1. Hey Jo, thanks so much for your comment! I just retested the snippet and I get no error – did you modify the snippet?

  15. Hi Rodolfo,

    thanks for this snippet! Works great!

    Do you know if there is a similar solution for the downloads table in case of digital products? The table contains the name of the product in form of a link to the product, and I need to remove this link, but could not find the corresponding hook. Thanks in advance!

    Cheers, Onno

    1. Onno, thanks so much for your comment! Yes, this is possible – but unfortunately this is custom work and I cannot provide a complementary solution here via the blog comments. Thanks a lot for your understanding! ~R

    2. Did you ever find a solution to this? I’m in the same boat.

  16. You are awesome, It worked

  17. Wonderful thank you

  18. I am trying to understand where do I add this snippet. Thanks!

    1. Hey Brigitte thanks for your comment! You can place this in your child theme’s functions.php file – if you need more guidance, please take a look at this video tutorial: https://businessbloomer.com/woocommerce-customization-hangout/. Hope this helps!

  19. PS – I did remove my that cart file and then realised that your snippet doesn’t work for the cart – obviously I was too enthusiastic to see that right away.
    Is there any way to remove the links from the products in the order table on the cart page? (apart from copying core files to child theme and editing them there)? I’d love that 🙂

    1. Ah Henriet, thanks for your 2 comments! Yes, the cart uses a different (yet, very similar) method. If you take a look at cart.php you will find the filter “woocommerce_cart_item_permalink”, which can be customised in a very similar way to the Order Table example. Hope this helps 🙂

      1. Hi Rodolfo! Sorry for the late reaction, but didn’t see your reply until I checked back on this page. Followed up on your hint and found the filter, combined it with the snippet you gave above and it works like a charm 🙂
        Made my day! Thanks a million, and wish you a great day and time in Chili, or where-ever you’re in South America now ^^.

        1. This is awesome. Thanks a lot Henriët!

  20. Hi Rodolfo 🙂
    Thank you so much for this snippet! Works great.
    I wanted to do this but I couldn’t find a similar snippet anywhere nor did I have enough coding abilities to do it myself… After a lot of searching on the internet I ended up by the last resort: editing the core files (yes, I copied them to my child theme first). That wasn’t a very great solution at all even though it worked. I knew that.
    This is so much better : no more tinkering with the cart file 😀
    ~Henriët *happy*

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 *