Поправить плагин woocommerce
Для товаров, у которых стоит ограничение по времени на скидку должен появляться банальный таймер.
Вот есть абсолютно подходящий для этого плагин https://axlmulat.com/woocommerce/woocommerce-tutorial-how-to-add-sales-countdown-timer-in-the-product-page/
Но при его включении слетает сайт, очень долго все грузится. Вся проблема лежит в этом коде.
// 3. echo Sale Timerfunction sales_timer_echo_product() {
global $product;
$regular_price = get_post_meta( $product->get_id(), '_sale_price_dates_to', true );
if(!empty($regular_price)) {
?>
}
} // end function
add_action( 'woocommerce_single_product_summary', 'sales_timer_echo_product', 12 ); // hook number
function sales_timer_scripts() {
wp_enqueue_script('countdown_plugin_min', "/wp-content/themes/" . basename(dirname(__FILE__)) . "/customjs/jquery.plugin.min.js" , array("jquery"), '', true);
wp_enqueue_script('countdown_js_min', "/wp-content/themes/" . basename(dirname(__FILE__)) . "/customjs/jquery.countdown.min.js" , array("jquery"), '', true);
wp_enqueue_script('custom_product_countdown', "/wp-content/themes/" . basename(dirname(__FILE__)) . "/customjs/product-countdown.js" , array("jquery"), '', true);
}
add_action( 'wp_enqueue_scripts', 'sales_timer_scripts' );Именно после того, как его кидаем в fucntions.php начинаются проблемы.
Необходимо поправить этот участок кода, чтоб сайт не слетал.