在woocommerce中添加邮政编码的静态下拉列表

时间:2017-05-09 11:52:48

标签: wordpress woocommerce

您好我正在使用wordpress网站。任何人都可以告诉我如何为邮政代码添加静态下拉列表。因为我只需要添加特定的地点进行交付。并且需要检查客户输入的位置是否可用于交付并显示消息,因为位置是无法送货。

'postcode' => array(
            'label'        => __( 'Postcode / ZIP', 'woocommerce' ),
            'required'     => true,
            'class'        => array( 'form-row-wide', 'address-field' ),
            'validate'     => array( 'postcode' ),
            'autocomplete' => 'postal-code',
            'priority'     => 90,
        ),

1 个答案:

答案 0 :(得分:2)

我们可以在此格式中添加woocommerce中的静态下拉列表。

'postcode' => array(
            'label'        => __( 'Area ( Delivery only applicable for area locations listed below  ) ', 'woocommerce' ),
            'required'     => true,
            'class'        => array( 'form-row-wide', 'address-field' ),
            'validate'     => array( 'postcode' ),
            'autocomplete' => 'postal-code',
            'priority'     => 90,
            'required'     => true,
            'type'         =>'select',
            'options'      =>array('opt1' => "Arekere", "Gottegere", "Billekhalli", "BTM Layout", "Puttenhalli", "Vijaya Bank Layout", "Hulimeavu", "JP Nagar", "Deverchekalli", "Kodichinalkalli", "Akshay Nagar", "DLF New Town", "SNN Raj Serenity")

        ),