'; } } } if ( ! function_exists( 'alpha_single_product_after_rating_end' ) ) { function alpha_single_product_after_rating_end() { global $alpha_layout; if ( empty( $alpha_layout['single_product_block'] ) ) { echo ''; } } } /** * Display sale countdown for simple & variable product in single product page. * * @since 1.0 * @param string $ends_label * @return void */ if ( ! function_exists( 'alpha_single_product_sale_countdown' ) ) { function alpha_single_product_sale_countdown( $ends_label = '' ) { global $product; if ( $product->is_on_sale() ) { $extra_class = ''; if ( $product->is_type( 'variable' ) ) { $variations = $product->get_available_variations( 'object' ); $date_diff = ''; $sale_date = ''; foreach ( $variations as $variation ) { if ( $variation->is_on_sale() ) { $new_date = get_post_meta( $variation->get_id(), '_sale_price_dates_to', true ); if ( ! $new_date || ( $date_diff && $date_diff != $new_date ) ) { $date_diff = false; } elseif ( $new_date ) { if ( false !== $date_diff ) { $date_diff = $new_date; } $sale_date = $new_date; } if ( false === $date_diff && $sale_date ) { break; } } } if ( $date_diff ) { $date_diff = date( 'Y/m/d H:i:s', (int) $date_diff ); } elseif ( $sale_date ) { $extra_class .= ' countdown-variations'; $date_diff = date( 'Y/m/d H:i:s', (int) $sale_date ); } } else { $date_diff = $product->get_date_on_sale_to(); if ( $date_diff ) { $date_diff = $date_diff->date( 'Y/m/d H:i:s' ); } } if ( $date_diff && defined( 'ALPHA_CORE_VERSION' ) ) { wp_enqueue_script( 'jquery-countdown' ); wp_enqueue_style( 'alpha-countdown', ALPHA_ASSETS . '/vendor/countdown/countdown' . ( is_rtl() ? '-rtl' : '' ) . '.min.css', array(), '6.7.0' ); wp_enqueue_script( 'alpha-countdown', ALPHA_ASSETS . '/vendor/countdown/countdown' . ALPHA_JS_SUFFIX, '6.7.0', true ); ?>