woocommerce_paypal_standard_order_created_response │ хук-событие │ WC 10.4.0

Fires after receiving a response from PayPal order creation.

This hook allows extensions to react to PayPal API responses, such as displaying admin notices or logging response data.

Note: This hook fires on EVERY order creation attempt (success or failure), and can be called multiple times for the same order if retried. Extensions hooking this should be idempotent and check order state/meta before taking action to avoid duplicate processing.

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

add_action( 'woocommerce_paypal_standard_order_created_response', 'wp_kama_woocommerce_paypal_standard_order_created_response_action', 10, 3 );

/**
 * Function for `woocommerce_paypal_standard_order_created_response` action-hook.
 * 
 * @param int|string $http_code     The HTTP status code from the PayPal API response.
 * @param array      $response_data The decoded response data from the PayPal API
 * @param WC_Order   $order         The WooCommerce order object.
 *
 * @return void
 */
function wp_kama_woocommerce_paypal_standard_order_created_response_action( $http_code, $response_data, $order ){
	// action...
}
$http_code(int|строка)
The HTTP status code from the PayPal API response.
$response_data(массив)
The decoded response data from the PayPal API
$order(WC_Order)
The WooCommerce order object.

Список изменений

С версии 10.4.0 Введена.

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

Request::create_paypal_order()
woocommerce_paypal_standard_order_created_response
woocommerce/src/Gateways/PayPal/Request.php 134
do_action( 'woocommerce_paypal_standard_order_created_response', $http_code, $response_array, $order );

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

woocommerce/includes/gateways/paypal/class-wc-gateway-paypal.php 227
add_action( 'woocommerce_paypal_standard_order_created_response', array( $this, 'manage_account_restriction_status' ), 10, 3 );