简体   繁体   中英

Disabling the link of a woocommerce product

I have been trying for a while now to remove the image link from a Woocommerce product. I tried snippets, css and plugins. But nothing seems to work, until I came across Vitaly Gritsienko's answer of Jul 5 2017.

Although the code he suggests (see below) for the functions.php file works, the hand icon is still visible. How can I remove the hand icon?

 //Removes links
 add_filter( 'woocommerce_product_is_visible','product_invisible');
 function product_invisible(){
 return false;
}

//Remove single page
add_filter( 'woocommerce_register_post_type_product','hide_product_page',12,1);
function hide_product_page($args){
$args["publicly_queryable"]=false;
$args["public"]=false;
return $args;
}

Actually, the simplest way is to edit the theme's woocommerce listing page to remove the link from the templating engine, although it's better to do it via a child theme so as not to interfere with the main theme's updates.

You can read more about child themes here: https://www.smashingmagazine.com/2016/01/create-customize-wordpress-child-theme/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM