woocommerce_paypal_standard_order_created_response action-hookWC 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.

Usage

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|string)
The HTTP status code from the PayPal API response.
$response_data(array)
The decoded response data from the PayPal API
$order(WC_Order)
The WooCommerce order object.

Changelog

Since 10.4.0 Introduced.

Where the hook is called

WC_Gateway_Paypal_Request::create_paypal_order()
woocommerce_paypal_standard_order_created_response
woocommerce/includes/gateways/paypal/includes/class-wc-gateway-paypal-request.php 180
do_action( 'woocommerce_paypal_standard_order_created_response', $http_code, $response_array, $order );

Where the hook is used in WooCommerce

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