将邮政编码文本字段更改为结帐表单中的选择选项字段(运送不工作)

时间:2018-01-10 12:02:12

标签: wordpress woocommerce shipping

在Woocommerce中,我将邮政编码文本字段名称更改为City,然后我更改为选择字段选项字段。但现在运输有问题:

  

没有可用的送货方式。请确保你的   地址输入正确,或者如果您需要,请与我们联系   帮助

我该怎么办?

view image

add_filter( 'woocommerce_default_address_fields' , 'customize_checkout_postcode_field' );
function customize_checkout_postcode_field( $address_fields ) {

    $towns_cities_arr = array(
        '0' => __('Select your city', 'my_theme_slug'),
        'DOHA' => 'DOHA',
        'OUT-OF-DOHA' => 'OUT-OF-DOHA',

    );

    $address_fields['postcode']['type'] = 'select';
    $address_fields['postcode']['class'] = array('form-row-last', 'my-custom-class'); // your class here
    $address_fields['postcode']['label'] = __('City _ المدينة', 'my_theme_slug');
    $address_fields['postcode']['default'] ='Doha';
    $address_fields['postcode']['options'] = $towns_cities_arr;

    return $address_fields;

}

0 个答案:

没有答案