1 回答

TA貢獻(xiàn)1799條經(jīng)驗(yàn) 獲得超6個(gè)贊
shipping_postcode未在您的代碼中設(shè)置
// Validate
function action_woocommerce_after_checkout_validation( $data, $error ) {
// The accepted delivery zones
$del_zones_array = array( 30030, 30032, 30033 );
// If the postal is not within the array, deny checkout
if( ! in_array( $data['shipping_postcode'], $del_zones_array ) ) {
$error->add( 'validation', 'The ZIP you provided is not available for oneline deliveries.' );
}
}
add_action('woocommerce_after_checkout_validation', 'action_woocommerce_after_checkout_validation', 10, 2 );
- 1 回答
- 0 關(guān)注
- 144 瀏覽
添加回答
舉報(bào)