Automattic\WooCommerce\Internal\Admin\Agentic

AgenticWebhookPayloadBuilder::determine_refund_typeprivateWC 1.0

Determine the refund type.

Method of the class: AgenticWebhookPayloadBuilder{}

Returns

String. Refund type ('store_credit' or 'original_payment').

Usage

// private - for code of main (parent) class only
$result = $this->determine_refund_type( $refund ): string;
$refund(WC_Order_Refund) (required)
Refund object.

AgenticWebhookPayloadBuilder::determine_refund_type() code WC 10.4.3

private function determine_refund_type( WC_Order_Refund $refund ): string {
	// Default to original payment method.
	$refund_type = RefundType::ORIGINAL_PAYMENT;

	/**
	 * Filter the refund type for Agentic webhooks.
	 *
	 * This allows extensions to specify when a refund is store credit.
	 * By default, all refunds are assumed to be original payment method.
	 *
	 * @since 10.4.0
	 * @param string          $refund_type The refund type ('store_credit' or 'original_payment').
	 * @param WC_Order_Refund $refund      The refund object.
	 */
	return apply_filters( 'woocommerce_agentic_webhook_refund_type', $refund_type, $refund );
}