I’m using another block to work inside products loop, which also can be encapsulated into shortcode function. Just added some check to avoid crashing if plugin is inactive:
if (in_array('wt-woocommerce-wishlist/wishlist-webtoffee.php', apply_filters('active_plugins', get_option('active_plugins')))){
$wt_wishlist = new WT_Wishlist_Looppage();
$wt_wishlist->render_webtoffee_wishlist_button();
}
So, shortcode for “Add to wishlist” button, which you can place anywhere in a loop of product blocks will be like this:
add_shortcode( 'cus_wishlist_loop_shortcode', 'woo_wishlist_loop_shortcode_func' );
function woo_wishlist_loop_shortcode_func() {
if (in_array('wt-woocommerce-wishlist/wishlist-webtoffee.php', apply_filters('active_plugins', get_option('active_plugins')))){
$wt_wishlist = new WT_Wishlist_Looppage();
$wt_wishlist->render_webtoffee_wishlist_button();
}
}