WordPress filter hook

woocommerce_loop_product_link

Defined by WooCommerce and fired by 14 plugins in total, running on 7M+ sites between them.

How to use woocommerce_loop_product_link

It's a filter: your callback receives the value and 1 more argument, and must return the (changed) value. Add this to your theme's functions.php or a small custom plugin:

functions.php
add_filter( 'woocommerce_loop_product_link', function( $the_permalink, $product ) {
	// Change $the_permalink here.
	return $the_permalink;
}, 10, 2 );

Argument names come from WooCommerce's source. Other plugins may pass different values: check the call in the plugin you're targeting below.

14 plugins that fire woocommerce_loop_product_link

Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.

  1. WooCommerce icon WooCommerce7+ million installs apply_filters( 'woocommerce_loop_product_link', get_the_permalink(), $product ) includes/wc-template-functions.php:1290
  2. Gutentor icon Gutentor30,000+ installs apply_filters( 'woocommerce_loop_product_link', get_the_permalink( $post->ID ), $product ) includes/block-base/class-gutentor-query-elements.php:2534
  3. Link Juice Optimizer icon Link Juice Optimizer5,000+ installs apply_filters( 'woocommerce_loop_product_link', get_the_permalink(), $product ) public/class-link-juice-optimizer-public.php:417
  4. Free Downloads WooCommerce icon Free Downloads WooCommerce4,000+ installs apply_filters( 'woocommerce_loop_product_link', get_the_permalink(), $product ) woo-files/somdn-woo-quickview-template.php:62
  5. WowStore icon WowStore4,000+ installs apply_filters( 'woocommerce_loop_product_link', sprintf( '<a href="%s" class="%s" data-stock="%s" data-add-to-cart-text="%s" %s>%s</a>', esc_url( $product->add_to_cart_url() ), ( ! empty( $args['class'] ) ? esc_attr( $args['class'] ) : '' ), esc_attr( $product->get_stock_quantity() ), esc_attr( $cart_text ), wc_implode_html_attributes( $attributes ), $inner_html ), $product, $args ) classes/Functions.php:3240
  6. Ovic Pinmap icon Ovic Pinmap200+ installs apply_filters( 'woocommerce_loop_product_link', $product->get_permalink(), $product ) includes/shortcode.php:126
  7. Shopready icon Shopready100+ installs apply_filters( 'woocommerce_loop_product_link', get_the_permalink(), $product ) src/extension/elegrid/hooks/product/Grid_Flip_Center_Structure.php:312
  8. Product Gallery Swiper for WooCommerce icon Product Gallery Swiper for WooCommerce100+ installs apply_filters( 'woocommerce_loop_product_link', get_permalink( $product->get_id() ), $product ) public/class-wdevs-gallery-swiper-public.php:676
  9. MyStyle Custom Product Designer icon MyStyle Custom Product Designer60+ installs apply_filters( 'woocommerce_loop_product_link', get_the_permalink(), $product ) includes/pages/class-mystyle-design-profile-page.php:1259
  10. Quicker icon Quicker10+ installs apply_filters( 'woocommerce_loop_product_link', get_the_permalink(), $product ) core/frontend/frontend.php:251
  11. SaSwatches icon SaSwatchesFewer than 10 installs apply_filters( 'woocommerce_loop_product_link', get_the_permalink(), $product ) inc/product.php:133
  12. Link Products to External websites for WooCommerce icon Link Products to External websites for WooCommerceFewer than 10 installs apply_filters( 'woocommerce_loop_product_link', get_the_permalink(), $product ) templates/content-momo-multiple-product.php:15
  13. Retail Media Network icon Retail Media NetworkFewer than 10 installs apply_filters( 'woocommerce_loop_product_link', get_the_permalink(), $product ) src/Utilities/RasOnetProductUtil.php:112
  14. Seekmodo Search icon Seekmodo SearchFewer than 10 installs apply_filters( 'woocommerce_loop_product_link', get_the_permalink(), $product ) src/Events/SerpAttributes.php:63

Need a customisation built on this hook?

Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.