我试图添加此代码,但它不排除周末。
add_action("woocommerce_after_add_to_cart_button", "custom_shipping_estimate");
function custom_shipping_estimate(){
$date1 = date("F j",strtotime("+ 2 days"));
$date2 = date("F j",strtotime("+ 4 days"));
echo "Arrives between $date1 and $date2";
}
您可以使用strtotimeweekday
日期时间格式
add_action("woocommerce_after_add_to_cart_button", "custom_shipping_estimate");
function custom_shipping_estimate(){
$date1 = date("F j",strtotime("+ 2 weekday"));
$date2 = date("F j",strtotime("+ 4 weekday"));
echo "Arrives between $date1 and $date2";
}