woocommerce_rest_checkout_process_payment_with_context хук-событиеWC 1.0

Process payment with context.

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

add_action( 'woocommerce_rest_checkout_process_payment_with_context', 'wp_kama_woocommerce_rest_checkout_process_payment_with_context_action', 10, 2 );

/**
 * Function for `woocommerce_rest_checkout_process_payment_with_context` action-hook.
 * 
 * @param PaymentContext $context        Holds context for the payment, including order ID and payment method.
 * @param PaymentResult  $payment_result Result object for the transaction.
 *
 * @return void
 */
function wp_kama_woocommerce_rest_checkout_process_payment_with_context_action( $context, $payment_result ){

	// action...
}
$context(PaymentContext)
Holds context for the payment, including order ID and payment method.
$payment_result(PaymentResult)
Result object for the transaction.

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

Checkout::process_payment()
woocommerce_rest_checkout_process_payment_with_context
woocommerce/packages/woocommerce-blocks/src/StoreApi/Routes/V1/Checkout.php 515
do_action_ref_array( 'woocommerce_rest_checkout_process_payment_with_context', [ $context, &$payment_result ] );

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

woocommerce/packages/woocommerce-blocks/src/StoreApi/Legacy.php 16
add_action( 'woocommerce_rest_checkout_process_payment_with_context', array( $this, 'process_legacy_payment' ), 999, 2 );