Product Page

WooCommerce Change Product Links On Grouped Products

Pre-Requisites

There are no pre-requisites in order for you to be able to implement this solution.

How To Implement This Solution?

Simply copy the pre-coded solution to your active theme’s functions.php or preferably the Code Snippets Plugin.

About This Solution

If you have grouped products set up on your site, you’ll notice the table which is output to the right of product image links all of the products which make up this grouped product. The exception being if your product is hidden from the catalogue. Linked products on a grouped product page can aid the customer experience – allowing the user to drill-down and get more specific information about the individual product. However, in some cases, this could reduce your Average Order Value (AOV) as the user may just buy the individual product. This snippet allows you to change the product links on grouped products to any other link you like. In this example specifically, we have changed the link to a simple anchor (#). In effect, this removes the links from the products, forcing the user to stay on the same page. Now, you may notice that once clicked, the user is taken to the very top of the screen – and that’s what an empty anchor typically does. If you’d like the user to stay in the same spot if they click a product name, simply add a string after the anchor which is not in use on the page. For example, returning “#reviews” will scroll the user to the reviews section on your single product page if the product link is clicked so don’t use that! Instead, you could use something like ‘#emptyanchor’. It’s not pretty, but it works. Sadly, the ‘a href’ actually wraps the filter hook so removing it doesn’t seem possible without editing the /templates/single-product/add-to-cart/grouped.php template file at the moment. In fact, removing the filter simply makes the link of the products the currently viewed grouped product which will refresh the entire page if clicked.

/**
 * Snippet Name:	WooCommerce Change Product Links On Grouped Products
 * Snippet Author:	ecommercehints.com
 */

function ecommercehints_change_grouped_product_link($get_permalink, $grouped_product_get_id) {
    return '#';
};

add_filter( 'woocommerce_grouped_product_list_link', 'ecommercehints_change_grouped_product_link', 10, 2 );

Snippet Benefits

  • Remove the individual product links from a grouped product, disabling users from navigating away form the grouped product.

100 WooCommerce Conversion Rate Optimisation Tips

This field is for validation purposes and should be left unchanged.

Let’s collaborate!

Need to outsource WordPress development?

Join forces with UnlimitedWP for an outsourced white label web development service you can truly rely on.

First Timer Here?

Sign up to receive 20% off on your first month with us.

26027
WELCOME OFFER