get_value( get_the_ID(), '_bubble_new' ) ) {
$bubble_text = $wc_cpdf->get_value( get_the_ID(), '_bubble_text' ) ? $wc_cpdf->get_value( get_the_ID(), '_bubble_text' ) : __( 'New', 'flatsome' );
// Extra Product bubbles.
$text .= '
';
}
return $text;
}
}
add_filter( 'flatsome_product_labels', 'flatsome_sale_flash', 10, 4 );
if ( ! function_exists( 'flatsome_woocommerce_get_alt_product_thumbnail' ) ) {
/**
* Get Hover image for WooCommerce Grid
*/
function flatsome_woocommerce_get_alt_product_thumbnail() {
$hover_style = get_theme_mod( 'product_hover', 'fade_in_back' );
if ( $hover_style !== 'fade_in_back' && $hover_style !== 'zoom_in' ) {
return;
}
global $product;
$attachment_ids = $product->get_gallery_image_ids();
$class = 'show-on-hover absolute fill hide-for-small back-image';
if ( $hover_style == 'zoom_in' ) {
$class .= $class . ' hover-zoom';
}
if ( $attachment_ids ) {
$loop = 0;
foreach ( $attachment_ids as $attachment_id ) {
$image_link = wp_get_attachment_url( $attachment_id );
if ( ! $image_link ) {
continue;
}
$loop ++;
echo apply_filters( 'flatsome_woocommerce_get_alt_product_thumbnail',
wp_get_attachment_image( $attachment_id, 'woocommerce_thumbnail', false, array( 'class' => $class ) ) );
if ( $loop == 1 ) {
break;
}
}
}
}
}
add_action( 'flatsome_woocommerce_shop_loop_images', 'flatsome_woocommerce_get_alt_product_thumbnail', 11 );
if ( ! function_exists( 'woocommerce_template_loop_product_title' ) ) {
/**
* Fix WooCommerce Loop Title
*/
function woocommerce_template_loop_product_title() {
echo '';
woocommerce_template_loop_product_link_open();
echo get_the_title(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
woocommerce_template_loop_product_link_close();
echo '
';
}
}
if ( ! function_exists( 'flatsome_woocommerce_shop_loop_category' ) ) {
/**
* Add and/or Remove Categories
*/
function flatsome_woocommerce_shop_loop_category() {
if ( ! flatsome_option( 'product_box_category' ) ) {
return;
} ?>
get_categories( '\n', '', '' );
$product_cats = strip_tags( $product_cats );
if ( $product_cats ) {
list( $first_part ) = explode( '\n', $product_cats );
echo esc_html( apply_filters( 'flatsome_woocommerce_shop_loop_category', $first_part, $product ) );
}
?>
add_to_cart_text() ) . '">+';
$link = preg_replace( '/().*?(<\/a>)/', '$1' . $insert . '$2', $link );
break;
case 'button':
$link = '' . $link . '
';
break;
default:
return $link;
}
return $link;
}
add_filter( 'woocommerce_loop_add_to_cart_link', 'flatsome_woocommerce_loop_add_to_cart_link', 5, 3 );
if ( ! function_exists( 'flatsome_woocommerce_shop_loop_excerpt' ) ) {
/**
* Add Product Short description
*/
function flatsome_woocommerce_shop_loop_excerpt() {
if ( ! flatsome_option( 'short_description_in_grid' ) ) {
return;
}
?>