user2700092
user2700092

Reputation: 49

Why woocommerce_loop_add_to_cart_link doesn't work within WooCommerce blocks?

I am creating a site for a friend in Woocommerce using the storefront theme. I have created a child theme and added the below function to the custom functions in functions.php. This is to change the add-to-basket buttons for single products into 'view product' links that point to the product page.

I am using Changing Woocommerce "Add to cart" button to "view product" button answer code.

This works great on everywhere intended across the site exept on WooCommerce Blocks (E.g. hand-picked products, top-rated products etc).

Can anyone tell me why and how I would rectify this?

Upvotes: 2

Views: 752

Answers (1)

LoicTheAztec
LoicTheAztec

Reputation: 253784

This is a bug (I reported that in Github WooCommerce Blocks opening an issue).

For now, instead you can use any WooCommerce Shortcode in a "paragraph" Block, which works without bugs using Changing Woocommerce "Add to cart" button to "view product" button, like:

enter image description here

Upvotes: 3

Related Questions