WC_Shipping_Legacy_Free_Shipping::init_form_fields()publicWC 1.0

Initialise Gateway Settings Form Fields.

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

Хуков нет.

Возвращает

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

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

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

Код WC_Shipping_Legacy_Free_Shipping::init_form_fields() WC 9.3.3

public function init_form_fields() {
	$this->form_fields = array(
		'enabled'      => array(
			'title'   => __( 'Enable/Disable', 'woocommerce' ),
			'type'    => 'checkbox',
			'label'   => __( 'Once disabled, this legacy method will no longer be available.', 'woocommerce' ),
			'default' => 'no',
		),
		'title'        => array(
			'title'       => __( 'Method title', 'woocommerce' ),
			'type'        => 'text',
			'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce' ),
			'default'     => __( 'Free Shipping', 'woocommerce' ),
			'desc_tip'    => true,
		),
		'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' ),
			),
		),
		'requires'     => array(
			'title'   => __( 'Free shipping requires...', 'woocommerce' ),
			'type'    => 'select',
			'class'   => 'wc-enhanced-select',
			'default' => '',
			'options' => array(
				''           => __( 'N/A', 'woocommerce' ),
				'coupon'     => __( 'A valid free shipping coupon', 'woocommerce' ),
				'min_amount' => __( 'A minimum order amount', 'woocommerce' ),
				'either'     => __( 'A minimum order amount OR a coupon', 'woocommerce' ),
				'both'       => __( 'A minimum order amount AND a coupon', 'woocommerce' ),
			),
		),
		'min_amount'   => array(
			'title'       => __( 'Minimum order amount', 'woocommerce' ),
			'type'        => 'price',
			'placeholder' => wc_format_localized_price( 0 ),
			'description' => __( 'Users will need to spend this amount to get free shipping (if enabled above).', 'woocommerce' ),
			'default'     => '0',
			'desc_tip'    => true,
		),
	);
}