Site logo

Archived topic

Remove link to product page from Woo hand-picked products block

9 replies · Started by jennifer on June 27, 2020

Viewing posts 1–10 of 10

[Edit: Added example page]

I downloaded a plugin so that on the WooCommerce hand-picked products block, I'd be able to replace the add to cart button with a direct purchase link.

The problem is that the product image still links to the product page.

How can I remove this link?

I tried adding the below code that I found to the functions file, but it doesn't work. The code author says that if it doesn’t work, it could be because the hooks and/or priorities of the theme could be different. Could you please advise?

if ( is_product() && is_product_category( array('nocartcat') ) ) {
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 );
}

Hi there,

can you provide a link to your site?
You can edit your original topic and use the Site URL field to share the link privately.

Just added. Thanks.

That URL takes me to a 404 not found page ?

Ah, sorry. It was set to private. Now it's public, so you can access.

Does that code work if you are using a twenty series WP default themes?

No, it does not.

That case please check with the plugin support again.

If they can provide the code that works with the default wp themes, it should work with GP as well.

The plugin is only meant to replace the "add to cart" link, and has nothing to do with the link from the product image, which I'm trying to remove.

Are you still able to help?

Are you referring to the WooCommerce blocks on the test page?

If so you'd need to check with their support unfortunately.

This archived topic is closed to new replies.