woocommerce_filter_fields_for_order_confirmation
Filter fields for order confirmation (thank you page, email).
Used in methods: WC_Email::additional_checkout_fields WC_Email::additional_address_fields CheckoutFieldsFrontend::render_order_other_fields CheckoutFieldsFrontend::render_order_address_fields AdditionalFields::render_content BillingAddress::render_content ShippingAddress::render_content
Использование
add_filter( 'woocommerce_filter_fields_for_order_confirmation', 'wp_kama_woocommerce_filter_fields_for_order_confirmation_filter', 10, 5 );
/**
* Function for `woocommerce_filter_fields_for_order_confirmation` filter-hook.
*
* @param bool $show_field Whether the field should be shown.
* @param array $field Field data.
* @param array $fields All fields for better context when field should be shown or
* hidden based on other fields values.
* @param array $context Additional context for the filter. Data depends in which method
* filter_fields_for_order_confirmation is called.
* @param CheckoutFields $instance The CheckoutFields instance.
*
* @return bool
*/
function wp_kama_woocommerce_filter_fields_for_order_confirmation_filter( $show_field, $field, $fields, $context, $instance ){
// filter...
return $show_field;
}
- $show_field(true|false)
- Whether the field should be shown.
- $field(массив)
- Field data.
- $fields(массив)
- All fields for better context when field should be shown or hidden based on other fields values.
- $context(массив)
- Additional context for the filter. Data depends in which method filter_fields_for_order_confirmation is called.
- $instance(CheckoutFields)
- The CheckoutFields instance.
Список изменений
| С версии 10.1.0 | Введена. |
Где вызывается хук
woocommerce_filter_fields_for_order_confirmation
woocommerce/src/Blocks/Domain/Services/CheckoutFields.php 920
return apply_filters( 'woocommerce_filter_fields_for_order_confirmation', ! empty( $field['show_in_order_confirmation'] ), $field, $fields, $context, $this );