admin管理员组文章数量:1393116
I added 3 States (they're regions, in fact) using this snippet (in functions.php
file):
/**
* Adds States
*/
add_filter( 'woocommerce_states', 'custom_woocommerce_states' );
function custom_woocommerce_states( $states ) {
$states['UY'] = array(
'UY1' => 'La Barra',
'UY2' => 'Punta del Este',
'UY3' => 'Maldonado'
);
return $states;
}
And I added a couple of shipping methods for each new 'State'.
The problem is when selecting the shipping address on the checkout, it doesn't show the corresponding shipping methods available. E.g. 'Maldonado' It only shows the correct shipping methods if I enter 'UY3'
I tried changing UY3 for Maldonado too, like this:
$states['UY'] = array(
'La Barra' => 'La Barra',
'Punta del Este' => 'Punta del Este',
'Maldonado' => 'Maldonado'
but it doesn't work either. I assume that the 2 characters country code is required.
How can I make it work so the customers could insert the State name for the shipping methods to show?
Notes:
- WordPress 5.3.2
- WooCommerce 4.0.1
I added 3 States (they're regions, in fact) using this snippet (in functions.php
file):
/**
* Adds States
*/
add_filter( 'woocommerce_states', 'custom_woocommerce_states' );
function custom_woocommerce_states( $states ) {
$states['UY'] = array(
'UY1' => 'La Barra',
'UY2' => 'Punta del Este',
'UY3' => 'Maldonado'
);
return $states;
}
And I added a couple of shipping methods for each new 'State'.
The problem is when selecting the shipping address on the checkout, it doesn't show the corresponding shipping methods available. E.g. 'Maldonado' It only shows the correct shipping methods if I enter 'UY3'
I tried changing UY3 for Maldonado too, like this:
$states['UY'] = array(
'La Barra' => 'La Barra',
'Punta del Este' => 'Punta del Este',
'Maldonado' => 'Maldonado'
but it doesn't work either. I assume that the 2 characters country code is required.
How can I make it work so the customers could insert the State name for the shipping methods to show?
Notes:
- WordPress 5.3.2
- WooCommerce 4.0.1
1 Answer
Reset to default 1go to Woocommerce -> Settings -> Shipping -> Shipping options and change the Shipping destination options
本文标签: customizationHow to customize shipping regionstates on WooCommerce
版权声明:本文标题:customization - How to customize shipping regionstates on WooCommerce 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744638958a2617000.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论