尝试始终将"发送到不同的地址"当用户在WooCommerce Checkout购买时清除。以下代码虽然没有做任何事情。是否有饼干待办?
add_filter( 'woocommerce_checkout_get_value', 'remove_clear_checkout_shipping_fields', 10, 2 );
function remove_clear_checkout_shipping_fields( $value, $input ) {
if ( strpos( $input, 'shipping_' ) !== FALSE ) {
$value = '';
}
}
答案 0 :(得分:0)
这样您就可以修改每个字段:
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
function custom_override_checkout_fields( $fields ) {
$fields['shipping']['shipping_first_name'] = '';
$fields['shipping']['shipping_last_name'] = '';
$fields['shipping']['shipping_company'] = '';
$fields['shipping']['shipping_address_1'] = '';
$fields['shipping']['shipping_address_2'] = '';
$fields['shipping']['shipping_city'] = '';
$fields['shipping']['shipping_postcode'] = '';
$fields['shipping']['shipping_country'] = '';
$fields['shipping']['shipping_state'] = '';
return $fields;
}
只需删除不必要的字段。