permalink}\" class=\"wc-block-grid__product-link\">
{$data->image}
";
// Sale badge
if( function_exists( 'botiga_sale_badge' ) ) {
$markup .= botiga_sale_badge( $html = '', $post, $product );
}
//Add button inside image wrapper for layout4 and layout3
if ( 'layout4' === $button_layout || 'layout3' === $button_layout ) {
$markup .= "
"
. botiga_gb_add_to_cart_button( $product ) .
"
";
}
//Quick view
if( function_exists( 'botiga_quick_view_button' ) ) {
$markup .= botiga_quick_view_button( $product, false );
}
//Wishlist
if( function_exists( 'botiga_wishlist_button' ) ) {
$markup .= botiga_wishlist_button( $product, false );
}
$markup .= "
";
if ( 'layout2' === $layout ) {
$markup .= "";
}
//Add button outside image wrapper
if ( 'layout1' !== $button_layout && 'layout4' !== $button_layout && 'layout3' !== $button_layout ) {
$markup .= ""
. botiga_gb_add_to_cart_button( $product ) .
"
";
}
$markup .= "";
return $markup;
}
add_filter( 'woocommerce_blocks_product_grid_item_html', 'botiga_filter_woocommerce_blocks', 10, 3 );
/**
* Gutenberg blocks add to cart
* replaces default add to cart block function to allow theme options
*/
function botiga_gb_add_to_cart_button( $product ) {
$button_layout = get_theme_mod( 'shop_product_add_to_cart_layout', 'layout3' );
//Button text
if ( 'layout4' !== $button_layout ) {
$text = esc_html( $product->add_to_cart_text() );
} else {
if ( $product->is_type( 'simple' ) ) {
$text = '' . botiga_get_svg_icon( 'icon-cart', false ) . '';
} else {
$text = '' . botiga_get_svg_icon( 'icon-eye', false ) . '';
}
}
//Start markup
$markup = '';
return $markup;
}