woocommerce_rest_prepare_fulfillments_providers filter-hookWC 10.5.0

Filters the shipping providers response before it is returned.

Each provider in the array must have the following structure:

  • 'label' (string): The display name of the provider.
  • 'icon' (string): URL to the provider's icon.
  • 'value' (string): The provider's unique identifier.
  • 'url' (string): The tracking URL template.

Usage

add_filter( 'woocommerce_rest_prepare_fulfillments_providers', 'wp_kama_woocommerce_rest_prepare_fulfillments_providers_filter', 10, 2 );

/**
 * Function for `woocommerce_rest_prepare_fulfillments_providers` filter-hook.
 * 
 * @param array           $providers The shipping providers data.
 * @param WP_REST_Request $request   The request object.
 *
 * @return array
 */
function wp_kama_woocommerce_rest_prepare_fulfillments_providers_filter( $providers, $request ){

	// filter...
	return $providers;
}
$providers(array)
The shipping providers data.
$request(WP_REST_Request)
The request object.

Changelog

Since 10.5.0 Introduced.

Where the hook is called

Controller::get_providers()
woocommerce_rest_prepare_fulfillments_providers
woocommerce/src/Internal/RestApi/Routes/V4/Fulfillments/Controller.php 463
$providers = apply_filters( 'woocommerce_rest_prepare_fulfillments_providers', $providers, $request );

Where the hook is used in WooCommerce

Usage not found.