get_value(get_the_ID(), '_product_video')){ ?>
trim( $wc_cpdf->get_value( get_the_ID(), '_product_video' ) ),
) );
}
// Custom Product Tabs
function flatsome_custom_product_tabs( $tabs ) {
global $wc_cpdf;
// Product video Tab
if($wc_cpdf->get_value(get_the_ID(), '_product_video_placement') == 'tab'){
$tabs['ux_video_tab'] = array(
'title' => __('Video','flatsome'),
'priority' => 10,
'callback' => 'flatsome_product_video_tab'
);
}
// Adds the new tab
if($wc_cpdf->get_value(get_the_ID(), '_custom_tab_title')){
$tabs['ux_custom_tab'] = array(
'title' => $wc_cpdf->get_value(get_the_ID(), '_custom_tab_title'),
'priority' => 40,
'callback' => 'flatsome_custom_tab_content'
);
}
// Custom Global Section
if(get_theme_mod('tab_title')){
$tabs['ux_global_tab'] = array(
'title' => get_theme_mod('tab_title'),
'priority' => 50,
'callback' => 'flatsome_global_tab_content'
);
}
// Move review tab to the last position
//$tabs['reviews']['priority'] = 100;
return $tabs;
}
add_filter( 'woocommerce_product_tabs', 'flatsome_custom_product_tabs' );
function flatsome_custom_tab_content() {
// The new tab content
global $wc_cpdf;
echo do_shortcode($wc_cpdf->get_value(get_the_ID(), '_custom_tab'));
}
function flatsome_global_tab_content() {
// The new tab content
echo do_shortcode(get_theme_mod('tab_content'));
}
function flatsome_product_tabs_classes(){
$classes = array('nav','nav-uppercase');
$tab_style = get_theme_mod('product_display','tabs');
if($tab_style == 'tabs' || !$tab_style){
$classes[] = 'nav-line';
} else{
$tab_style = str_replace("tabs_","",$tab_style);
if($tab_style == 'vertical') $classes[] = 'nav-line';
if($tab_style == 'normal') $classes[] = 'nav-tabs';
$classes[] = 'nav-'.$tab_style;
}
$align = get_theme_mod('product_tabs_align','left');
if($align){
$classes[] = 'nav-'.$align;
}
echo implode(' ', $classes);
}
/**
* Displays the product brand(s).
*/
function flatsome_product_brands() {
if ( ! get_theme_mod( 'product_brands' ) ) {
return;
}
echo '
';
echo flatsome_apply_shortcode( 'product_brand', array(
'class' => '',
) );
echo '
';
}
add_action( 'woocommerce_single_product_summary', 'flatsome_product_brands', 1 );
// Add Custom HTML Blocks
function flatsome_before_add_to_cart_html(){
echo do_shortcode(get_theme_mod('html_before_add_to_cart'));
}
add_action( 'woocommerce_single_product_summary', 'flatsome_before_add_to_cart_html', 20);
// Add HTML after Add to Cart button
function flatsome_after_add_to_cart_html(){
echo do_shortcode(get_theme_mod('html_after_add_to_cart'));
}
add_action( 'woocommerce_single_product_summary', 'flatsome_after_add_to_cart_html', 30);
// Add Custom HTML to top of product page
function flatsome_product_top_content(){
global $wc_cpdf;
if($wc_cpdf->get_value(get_the_ID(), '_top_content')){
echo do_shortcode($wc_cpdf->get_value(get_the_ID(), '_top_content'));
}
}
add_action('flatsome_before_product_page','flatsome_product_top_content', 10);
// Add Custom HTML to bottom of product page
function flatsome_product_bottom_content(){
global $wc_cpdf;
if($wc_cpdf->get_value(get_the_ID(), '_bottom_content')){
echo do_shortcode($wc_cpdf->get_value(get_the_ID(), '_bottom_content'));
}
}
add_action('flatsome_after_product_page','flatsome_product_bottom_content', 10);
function flatsome_related_products_args( $args ) {
$args['posts_per_page'] = (int) get_theme_mod( 'max_related_products', 8 );
return $args;
}
add_filter( 'woocommerce_output_related_products_args', 'flatsome_related_products_args' );
/**
* Sticky add to cart template.
*
* @return void
*/
function flatsome_sticky_add_to_cart_template() {
global $product;
if (
! get_theme_mod( 'product_sticky_cart', 0 )
|| ! is_product()
|| ! is_a( $product, 'WC_Product' )
|| ! $product->is_purchasable()
|| ! apply_filters( 'flatsome_sticky_add_to_cart_enabled', true, $product )
) {
return;
}
$classes = array( 'sticky-add-to-cart' );
$product_classes = implode( ' ', array_diff( wc_get_product_class( 'sticky-add-to-cart__product', $product ), [ 'product' ] ) );
if ( get_theme_mod( 'content_color' ) === 'dark' ) {
$classes[] = 'dark';
}
?>
'attachment-woocommerce_gallery_thumbnail size-woocommerce_gallery_thumbnail sticky-add-to-cart-img',
) );
?>
is_type( 'simple' ) ) :
woocommerce_simple_add_to_cart();
else :
echo $product->get_price_html(); // phpcs:ignore WordPress.Security.EscapeOutput
echo flatsome_apply_shortcode( 'button', array(
'class' => 'sticky-add-to-cart-select-options-button mb-0 ml-half',
'color' => 'secondary',
'text' => $product->is_type( 'variable' ) ? esc_html__( 'Select options', 'flatsome' ) : $product->single_add_to_cart_text(),
) );
endif;
?>