WC_Shipping_Free_Shipping::init_form_fields()publicWC 1.0

Init form fields.

Method of the class: WC_Shipping_Free_Shipping{}

No Hooks.

Return

null. Nothing (null).

Usage

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

WC_Shipping_Free_Shipping::init_form_fields() code WC 8.6.1

public function init_form_fields() {
	$this->instance_form_fields = array(
		'title'            => array(
			'title'       => __( 'Name', 'woocommerce' ),
			'type'        => 'text',
			'description' => __( 'Your customers will see the name of this shipping method during checkout.', 'woocommerce' ),
			'default'     => $this->method_title,
			'placeholder' => __( 'e.g. Free shipping', 'woocommerce' ),
			'desc_tip'    => true,
		),
		'requires'         => array(
			'title'   => __( 'Free shipping requires', 'woocommerce' ),
			'type'    => 'select',
			'class'   => 'wc-enhanced-select',
			'default' => '',
			'options' => array(
				''           => __( 'No requirement', 'woocommerce' ),
				'coupon'     => __( 'A valid free shipping coupon', 'woocommerce' ),
				'min_amount' => __( 'A minimum order amount', 'woocommerce' ),
				'either'     => __( 'A minimum order amount OR coupon', 'woocommerce' ),
				'both'       => __( 'A minimum order amount AND coupon', 'woocommerce' ),
			),
		),
		'min_amount'       => array(
			'title'             => __( 'Minimum order amount', 'woocommerce' ),
			'type'              => 'text',
			'class'             => 'wc-shipping-modal-price',
			'placeholder'       => wc_format_localized_price( 0 ),
			'description'       => __( 'Customers will need to spend this amount to get free shipping.', 'woocommerce' ),
			'default'           => '0',
			'desc_tip'          => true,
			'sanitize_callback' => array( $this, 'sanitize_cost' ),
		),
		'ignore_discounts' => array(
			'title'       => __( 'Coupons discounts', 'woocommerce' ),
			'label'       => __( 'Apply minimum order rule before coupon discount', 'woocommerce' ),
			'type'        => 'checkbox',
			'description' => __( 'If checked, free shipping would be available based on pre-discount order amount.', 'woocommerce' ),
			'default'     => 'no',
			'desc_tip'    => true,
		),
	);
}