WC_Meta_Box_Order_Data::get_shipping_fields
Get shipping fields for the meta box.
Method of the class: WC_Meta_Box_Order_Data{}
Hooks from the method
Returns
Array.
Usage
$result = WC_Meta_Box_Order_Data::get_shipping_fields( $order, $context );
- $order(WC_Order)
- Order object.
Default:false - $context(string)
- Context of fields (view or edit).
Default:'edit'
WC_Meta_Box_Order_Data::get_shipping_fields() WC Meta Box Order Data::get shipping fields code WC 10.5.0
protected static function get_shipping_fields( $order = false, $context = 'edit' ) {
/**
* Provides an opportunity to modify the list of order shipping fields displayed on the admin.
*
* @since 1.4.0
*
* @param array Shipping fields.
* @param WC_Order|false $order Order object.
* @param string $context Context of fields (view or edit).
*/
return apply_filters(
'woocommerce_admin_shipping_fields',
array(
'first_name' => array(
'label' => __( 'First name', 'woocommerce' ),
'show' => false,
),
'last_name' => array(
'label' => __( 'Last name', 'woocommerce' ),
'show' => false,
),
'company' => array(
'label' => __( 'Company', 'woocommerce' ),
'show' => false,
),
'address_1' => array(
'label' => __( 'Address line 1', 'woocommerce' ),
'show' => false,
),
'address_2' => array(
'label' => __( 'Address line 2', 'woocommerce' ),
'show' => false,
),
'city' => array(
'label' => __( 'City', 'woocommerce' ),
'show' => false,
),
'postcode' => array(
'label' => __( 'Postcode / ZIP', 'woocommerce' ),
'show' => false,
),
'country' => array(
'label' => __( 'Country / Region', 'woocommerce' ),
'show' => false,
'type' => 'select',
'class' => 'js_field-country select short',
'options' => array( '' => __( 'Select a country / region…', 'woocommerce' ) ) + WC()->countries->get_countries(),
),
'state' => array(
'label' => __( 'State / County', 'woocommerce' ),
'class' => 'js_field-state select short',
'show' => false,
),
'phone' => array(
'label' => __( 'Phone', 'woocommerce' ),
),
),
$order,
$context
);
}