get_available_payment_gateways() does not return BACS


I am dealing with a weird WooCommerce issue where WC()->payment_gateways->get_available_payment_gateways() does not return all enabled payment gateways. It returns one of the payment gateways, but I have just enabled "Bank Transfer" (BACS), but it does not show up on the list. I have tried clearing all cache, but still it won’t show up. I have verified it is enabled on options.

If I instead call WC()->payment_gateways->payment_gateways() and filter the ones where "enabled" === ‘yes’, then it works.

So, this works:

array_filter(WC()->payment_gateways->payment_gateways(), function ($gateway) { return $gateway->enabled === 'yes'; }) // return the two activated payment gateways

This does not:

WC()->payment_gateways->get_available_payment_gateways() // returns one payment gateway
FooBar 8 months 2020-12-02T04:10:20-05:00 0 Answers 13 views 0

Leave an answer