WC_Frontend_Scripts::get_gateways_with_custom_place_order_button
Get a list of payment gateway IDs that have custom place order buttons.
Method of the class: WC_Frontend_Scripts{}
No Hooks.
Returns
Array. List of gateway IDs with custom place order buttons.
Usage
$result = WC_Frontend_Scripts::get_gateways_with_custom_place_order_button();
WC_Frontend_Scripts::get_gateways_with_custom_place_order_button() WC Frontend Scripts::get gateways with custom place order button code WC 10.7.0
private static function get_gateways_with_custom_place_order_button() {
$gateways_with_custom_button = array();
if ( ! WC()->payment_gateways() ) {
return $gateways_with_custom_button;
}
$available_gateways = WC()->payment_gateways()->get_available_payment_gateways();
foreach ( $available_gateways as $gateway ) {
// phpcs:ignore Squiz.PHP.CommentedOutCode.Found -- Type hint for PHPStan.
/* @var WC_Payment_Gateway $gateway */
if ( true === $gateway->has_custom_place_order_button ) {
$gateways_with_custom_button[] = $gateway->id;
}
}
return $gateways_with_custom_button;
}