添加预计交货日期范围?
Add Estimated delivery date range?
我想添加预计交货日期范围。例如,如果今天(2 月 21 日)订购
所需的输出应该是这样的:
预计 2 月 24 日星期四至 2 月 26 日星期六交货
add_action( 'woocommerce_single_product_summary', 'delivery_date_range',11 );
function delivery_date_range() {
date_default_timezone_set( 'India' );
// date_from must be from 3rd day (from order date)
// date_to must be the next 5th days
$html = "<br><div>Estimated delivery by {$date_from} to {$date_to}</div>";
echo $html;
}
add_action('woocommerce_single_product_summary', 'delivery_date_range', 11);
function delivery_date_range() {
// date_from must be from 3rd day (from order date)
// date_to must be the next 5th days
$date = date('Y-m-d');
$three_day_from_today = date('j F, Y', strtotime($date . ' + 3 days'));
$fifth_day_from_today = date('j F, Y', strtotime($date . ' + 5 days'));
$html = "<br><div>Estimated delivery by {$three_day_from_today} to {$fifth_day_from_today}</div>";
echo $html;
}
的手册
我想添加预计交货日期范围。例如,如果今天(2 月 21 日)订购
所需的输出应该是这样的:
预计 2 月 24 日星期四至 2 月 26 日星期六交货
add_action( 'woocommerce_single_product_summary', 'delivery_date_range',11 );
function delivery_date_range() {
date_default_timezone_set( 'India' );
// date_from must be from 3rd day (from order date)
// date_to must be the next 5th days
$html = "<br><div>Estimated delivery by {$date_from} to {$date_to}</div>";
echo $html;
}
add_action('woocommerce_single_product_summary', 'delivery_date_range', 11);
function delivery_date_range() {
// date_from must be from 3rd day (from order date)
// date_to must be the next 5th days
$date = date('Y-m-d');
$three_day_from_today = date('j F, Y', strtotime($date . ' + 3 days'));
$fifth_day_from_today = date('j F, Y', strtotime($date . ' + 5 days'));
$html = "<br><div>Estimated delivery by {$three_day_from_today} to {$fifth_day_from_today}</div>";
echo $html;
}
的手册