From 3a9604bf785f03484b64bdfbb93cede10bf6fc07 Mon Sep 17 00:00:00 2001 From: Gerhard Date: Tue, 18 Feb 2014 11:58:52 +0200 Subject: [PATCH] Fix COD warning when you have hide shipping methods until address entered selected --- includes/gateways/cod/class-wc-gateway-cod.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/includes/gateways/cod/class-wc-gateway-cod.php b/includes/gateways/cod/class-wc-gateway-cod.php index d5c17add398..415979c18d6 100644 --- a/includes/gateways/cod/class-wc-gateway-cod.php +++ b/includes/gateways/cod/class-wc-gateway-cod.php @@ -107,7 +107,10 @@ class WC_Gateway_COD extends WC_Payment_Gateway { if ( ! empty( $this->enable_for_methods ) ) { // Only apply if all packages are being shipped via local pickup - $chosen_shipping_methods = array_unique( WC()->session->get( 'chosen_shipping_methods' ) ); + $chosen_shipping_methods_session = WC()->session->get( 'chosen_shipping_methods' ); + if ( isset( $chosen_shipping_methods_session ) ) + $chosen_shipping_methods = array_unique( $chosen_shipping_methods_session ); + else $chosen_shipping_methods = array(); $check_method = false; if ( is_page( wc_get_page_id( 'checkout' ) ) && ! empty( $wp->query_vars['order-pay'] ) ) {