WC_Shipping_Legacy_Local_Delivery::init_form_fields()

Init form fields.


Description Description


Source Source

File: includes/shipping/legacy-local-delivery/class-wc-shipping-legacy-local-delivery.php

114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
public function init_form_fields() {
    $this->form_fields = array(
        'enabled'      => array(
            'title'   => __( 'Enable', 'woocommerce' ),
            'type'    => 'checkbox',
            'label'   => __( 'Once disabled, this legacy method will no longer be available.', 'woocommerce' ),
            'default' => 'no',
        ),
        'title'        => array(
            'title'       => __( 'Title', 'woocommerce' ),
            'type'        => 'text',
            'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce' ),
            'default'     => __( 'Local delivery', 'woocommerce' ),
            'desc_tip'    => true,
        ),
        'type'         => array(
            'title'       => __( 'Fee type', 'woocommerce' ),
            'type'        => 'select',
            'class'       => 'wc-enhanced-select',
            'description' => __( 'How to calculate delivery charges', 'woocommerce' ),
            'default'     => 'fixed',
            'options'     => array(
                'fixed'   => __( 'Fixed amount', 'woocommerce' ),
                'percent' => __( 'Percentage of cart total', 'woocommerce' ),
                'product' => __( 'Fixed amount per product', 'woocommerce' ),
            ),
            'desc_tip'    => true,
        ),
        'fee'          => array(
            'title'       => __( 'Delivery fee', 'woocommerce' ),
            'type'        => 'price',
            'description' => __( 'What fee do you want to charge for local delivery, disregarded if you choose free. Leave blank to disable.', 'woocommerce' ),
            'default'     => '',
            'desc_tip'    => true,
            'placeholder' => wc_format_localized_price( 0 ),
        ),
        'codes'        => array(
            'title'       => __( 'Allowed ZIP/post codes', 'woocommerce' ),
            'type'        => 'text',
            'desc_tip'    => __( 'What ZIP/post codes are available for local delivery?', 'woocommerce' ),
            'default'     => '',
            'description' => __( 'Separate codes with a comma. Accepts wildcards, e.g. <code>P*</code> will match a postcode of PE30. Also accepts a pattern, e.g. <code>NG1___</code> would match NG1 1AA but not NG10 1AA', 'woocommerce' ),
            'placeholder' => 'e.g. 12345, 56789',
        ),
        'availability' => array(
            'title'   => __( 'Method availability', 'woocommerce' ),
            'type'    => 'select',
            'default' => 'all',
            'class'   => 'availability wc-enhanced-select',
            'options' => array(
                'all'      => __( 'All allowed countries', 'woocommerce' ),
                'specific' => __( 'Specific Countries', 'woocommerce' ),
            ),
        ),
        'countries'    => array(
            'title'             => __( 'Specific countries', 'woocommerce' ),
            'type'              => 'multiselect',
            'class'             => 'wc-enhanced-select',
            'css'               => 'width: 400px;',
            'default'           => '',
            'options'           => WC()->countries->get_shipping_countries(),
            'custom_attributes' => array(
                'data-placeholder' => __( 'Select some countries', 'woocommerce' ),
            ),
        ),
    );
}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.