get_available_payment_gateways() does not return BACS

Question

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
0
FooBar 2 months 0 Answers 13 views 0

Leave an answer