From 2885da45813c62ec1f17b00db3fded915fad4a74 Mon Sep 17 00:00:00 2001 From: Scott Basgaard Date: Tue, 26 Nov 2013 17:48:39 +0100 Subject: [PATCH 1/2] "Order again" doesn't work. Proposed pass at fix. --- includes/class-wc-form-handler.php | 2 +- includes/wc-conditional-functions.php | 5 +++++ includes/wc-template-functions.php | 2 +- woocommerce.php | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/includes/class-wc-form-handler.php b/includes/class-wc-form-handler.php index 99a52d32907..ccaff73b7b0 100644 --- a/includes/class-wc-form-handler.php +++ b/includes/class-wc-form-handler.php @@ -391,7 +391,7 @@ class WC_Form_Handler { public function order_again() { // Nothing to do - if ( ! isset( $_GET['order_again'] ) || ! is_user_logged_in() || ! WC()->verify_nonce( 'order_again', '_GET' ) || ! wp_verify_nonce( $_GET['_wpnonce'], 'woocommerce-order_again' ) ) + if ( ! isset( $_GET['order_again'] ) || ! is_user_logged_in() || ! wp_verify_nonce( $_GET['_wpnonce'], 'woocommerce-order_again' ) ) return; // Clear current cart diff --git a/includes/wc-conditional-functions.php b/includes/wc-conditional-functions.php index e1bc5dfc2b4..10387809c77 100644 --- a/includes/wc-conditional-functions.php +++ b/includes/wc-conditional-functions.php @@ -231,6 +231,11 @@ if ( ! function_exists( 'meta_is_product_attribute' ) ) { */ function meta_is_product_attribute( $name, $value, $product_id ) { $product = get_product( $product_id ); + + if ( $product->product_type != 'variation' ) { + return false; + } + $attributes = $product->get_variation_attributes(); var_dump($attributes[ $name ]); diff --git a/includes/wc-template-functions.php b/includes/wc-template-functions.php index fc344bba20b..fd77ce05f8a 100644 --- a/includes/wc-template-functions.php +++ b/includes/wc-template-functions.php @@ -1496,7 +1496,7 @@ if ( ! function_exists( 'woocommerce_order_again_button' ) ) { ?>

- +

verify_nonce', '2.1', 'WC_Nonce_Helper->verify_nonce' ); + _deprecated_function( 'Woocommerce->verify_nonce', '2.1', '' ); return wp_verify_nonce( $$method[ '_wpnonce' ], 'woocommerce-' . $action ); } From 42f09851af33782883b563770f86968b2c5c5646 Mon Sep 17 00:00:00 2001 From: Scott Basgaard Date: Tue, 26 Nov 2013 17:52:02 +0100 Subject: [PATCH 2/2] WC_Nonce_Helper is no longer. Use wp_verify_nonce() instead. --- woocommerce.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/woocommerce.php b/woocommerce.php index 9fdfdfc703a..97556ee4cf1 100644 --- a/woocommerce.php +++ b/woocommerce.php @@ -680,7 +680,7 @@ final class WooCommerce { * @return bool */ public function verify_nonce( $action, $method = '_POST', $error_message = false ) { - _deprecated_function( 'Woocommerce->verify_nonce', '2.1', '' ); + _deprecated_function( 'Woocommerce->verify_nonce', '2.1', 'wp_verify_nonce' ); return wp_verify_nonce( $$method[ '_wpnonce' ], 'woocommerce-' . $action ); }