woocommerce_rest_prepare_payment_gateway хук-фильтрWC 1.0

Filter payment gateway objects returned from the REST API.

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

add_filter( 'woocommerce_rest_prepare_payment_gateway', 'wp_kama_woocommerce_rest_prepare_payment_gateway_filter', 10, 3 );

/**
 * Function for `woocommerce_rest_prepare_payment_gateway` filter-hook.
 * 
 * @param WP_REST_Response   $response The response object.
 * @param WC_Payment_Gateway $gateway  Payment gateway object.
 * @param WP_REST_Request    $request  Request object.
 *
 * @return WP_REST_Response
 */
function wp_kama_woocommerce_rest_prepare_payment_gateway_filter( $response, $gateway, $request ){

	// filter...
	return $response;
}
$response(WP_REST_Response)
The response object.
$gateway(WC_Payment_Gateway)
Payment gateway object.
$request(WP_REST_Request)
Request object.

Где вызывается хук

WC_REST_Payment_Gateways_Controller::prepare_item_for_response()
woocommerce_rest_prepare_payment_gateway
WC_REST_Payment_Gateways_V2_Controller::prepare_item_for_response()
woocommerce_rest_prepare_payment_gateway
woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-payment-gateways-controller.php 63
return apply_filters( 'woocommerce_rest_prepare_payment_gateway', $response, $gateway, $request );
woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-payment-gateways-v2-controller.php 278
return apply_filters( 'woocommerce_rest_prepare_payment_gateway', $response, $gateway, $request );

Где используется хук в WooCommerce

woocommerce/src/Admin/Features/PaymentGatewaySuggestions/PaymentGatewaysController.php 21
add_filter( 'woocommerce_rest_prepare_payment_gateway', array( __CLASS__, 'extend_response' ), 10, 3 );