Skip to content

Instantly share code, notes, and snippets.

@radiustheme
Last active July 24, 2019 05:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save radiustheme/9499e1d12468abcf32294f79c56914fb to your computer and use it in GitHub Desktop.
Save radiustheme/9499e1d12468abcf32294f79c56914fb to your computer and use it in GitHub Desktop.
How to remove full link from Product category or archive page in WooCommerce Variation Swatches by RadiusTheme
<?php
//Place this code in end of your theme function.php
// Add By RadiusTheme Support
remove_action('woocommerce_before_shop_loop_item', 'woocommerce_template_loop_product_link_open', 10);
remove_action('woocommerce_after_shop_loop_item', 'woocommerce_template_loop_product_link_close', 5);
add_action('woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_link_open', 5);
add_action('woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_link_close', 20);
function woocommerce_template_loop_product_title() {
echo sprintf('<h2 class="woocommerce-loop-product__title"><a title="%2$s" href="%1$s">%2$s</a></h2>',
get_the_permalink(),
get_the_title()
);
}
?>
@radiustheme
Copy link
Author

If you want to remove the full link from the product loop of the WooCommerce category or archive page use the above code. We use this code for our WooCommerce Variation Swatches plugin https://www.radiustheme.com/downloads/woocommerce-variation-swatches/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment