Automattic\WooCommerce\Blocks\Payments

PaymentMethodRegistry::get_all_registered_script_data()publicWC 1.0

Gets an array of all registered payment method script data, but only for active payment methods.

Method of the class: PaymentMethodRegistry{}

No Hooks.

Return

Array.

Usage

$PaymentMethodRegistry = new PaymentMethodRegistry();
$PaymentMethodRegistry->get_all_registered_script_data();

PaymentMethodRegistry::get_all_registered_script_data() code WC 9.0.1

public function get_all_registered_script_data() {
	$script_data     = [];
	$payment_methods = $this->get_all_active_registered();

	foreach ( $payment_methods as $payment_method ) {
		$script_data[ $payment_method->get_name() ] = $payment_method->get_payment_method_data();
	}

	return array( 'paymentMethodData' => array_filter( $script_data ) );
}