This topic has 8 replies, 4 voices, and was last updated 9 years, 1 months ago ago by Stan Russell
I’m trying to call a function only on front page but the usually condition for doin that doesn’t work for me. Here is what i am trying to do.
* replace add to cart with view product */
function remove_loop_button(){
if ( is_front_page() ) {
remove_action( ‘woocommerce_after_shop_loop_item’, ‘woocommerce_template_loop_add_to_cart’, 9 );
}
}
add_action(‘init’,’remove_loop_button’);
add_action(‘woocommerce_after_shop_loop_item’,’replace_add_to_cart’);
function replace_add_to_cart() {
if ( is_front_page() ) {
global $product;
$link = $product->get_permalink();
echo do_shortcode(‘View product‘);
}
}
The problem is is_front_page() won’t identify the frontpage, cause the function works without that condition. So i wonder if there is anything i have done wrong?
Hello,
Please provide us with FTP and wp-admin panel credentials in Private Content.
Regards,
Eva Kemp.
I don’t own the website so I can’t give out details.
Could you just correct the function I wrote so it will work with Woopress theme?
Hello,
It’s difficult to investigate the issue without seeing wp-admin panel.
Is your page set as front page in Settings > Reading?
Best regards,
Jack Richardson.
Managed to solve this.
My next problem is how do i make a Woocommerce thumbnail image clickable, so when clicked one is forwarded to the single product page?
Hello,
There is no such option in the theme, you should refer to Woocommerce support, also read this article:
https://slocumthemes.com/2015/10/how-to-make-woocommerce-thumbnails-clickable/
Best regards,
Jack Richardson.
I tried that solution but it didn’t work, I will try woocommerce support.
Hello kristofferj,
we wish you with Woocommerce support to solve this problem in no time.
Regards,
Stan Russell.
You must be logged in to reply to this topic.Log in/Sign up