Last active
December 12, 2021 19:07
-
-
Save vladi160/8d99626b2693957c7cea0641ed4e6e9e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_shortcode('timer', 'cart_page_shipping_timer', 10); | |
function cart_page_shipping_timer() { | |
// Change timezone if needed | |
date_default_timezone_set( 'Europe/Sofia' ); | |
global $product; | |
$isInStock = $product->get_stock_quantity() > 0; | |
var_dump($product->get_stock_quantity()); | |
echo '<pre>'; | |
var_dump($product); | |
$order_by = "днес"; | |
if ( date( 'N' ) >= 5 ) { | |
// if FRI/SAT/SUN delivery will be MON | |
$del_day = date( "във вторник", strtotime( "next tuesday" )); | |
} elseif ( date( 'H' ) >= 13) { | |
// if MON/THU after 4PM delivery will be day after tomorrow | |
$del_day = date("на d-m-yг.", strtotime("tomorrow + 1 day" ) ); | |
$order_by = "утре"; | |
} else { | |
// if MON/THU before 4PM delivery will be TOMORROW | |
$del_day = date( " утре ", strtotime( "tomorrow" ) ); | |
} | |
//Change text if needed | |
$html = "<br><div class='massagess21' style='clear:bot; font-weight: 600; text-align: center;'>Поръчай сега и ще получиш {$del_day}</div>"; | |
echo $html; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment