WC_Shipping_Legacy_Local_Delivery::init_form_fields()publicWC 1.0

Init form fields.

Метод класса: WC_Shipping_Legacy_Local_Delivery{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$WC_Shipping_Legacy_Local_Delivery = new WC_Shipping_Legacy_Local_Delivery();
$WC_Shipping_Legacy_Local_Delivery->init_form_fields();

Код WC_Shipping_Legacy_Local_Delivery::init_form_fields() WC 9.4.2

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' ),
			),
		),
	);
}