From ec1b16340b6dcaf337eabc8322b3fbedd2a97898 Mon Sep 17 00:00:00 2001 From: tamarazuk Date: Sat, 3 May 2014 01:32:37 -0400 Subject: [PATCH 1/2] COD: no need to hide in admin Also fixes a fatal error when WC()->payment_gateways()->get_available_payment_gateways() is called in the admin --- includes/gateways/cod/class-wc-gateway-cod.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/gateways/cod/class-wc-gateway-cod.php b/includes/gateways/cod/class-wc-gateway-cod.php index 2468e16c46b..5afee9ed9a6 100644 --- a/includes/gateways/cod/class-wc-gateway-cod.php +++ b/includes/gateways/cod/class-wc-gateway-cod.php @@ -108,7 +108,7 @@ class WC_Gateway_COD extends WC_Payment_Gateway { public function is_available() { $order = null; - if ( ! WC()->cart->needs_shipping() ) { + if ( ! is_admin() && ! WC()->cart->needs_shipping() ) { return false; } From a9ebcdd8c67cda5d65c755ae83549962dce2476c Mon Sep 17 00:00:00 2001 From: Tamara Zuk Date: Tue, 6 May 2014 16:04:25 -0400 Subject: [PATCH 2/2] COD: check if cart is available before checking if it needs shipping --- includes/gateways/cod/class-wc-gateway-cod.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/gateways/cod/class-wc-gateway-cod.php b/includes/gateways/cod/class-wc-gateway-cod.php index 5afee9ed9a6..83d21042349 100644 --- a/includes/gateways/cod/class-wc-gateway-cod.php +++ b/includes/gateways/cod/class-wc-gateway-cod.php @@ -108,7 +108,7 @@ class WC_Gateway_COD extends WC_Payment_Gateway { public function is_available() { $order = null; - if ( ! is_admin() && ! WC()->cart->needs_shipping() ) { + if ( WC()->cart && ! WC()->cart->needs_shipping() ) { return false; }