From d7dbf47273798b6e9d0cab1a6bfc8bd83a17a525 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Tue, 8 Apr 2014 10:29:51 +0100 Subject: [PATCH] reset grouped products correctly to work with short codes --- templates/single-product/add-to-cart/grouped.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/templates/single-product/add-to-cart/grouped.php b/templates/single-product/add-to-cart/grouped.php index d032c1dfbf3..3c403318d6c 100644 --- a/templates/single-product/add-to-cart/grouped.php +++ b/templates/single-product/add-to-cart/grouped.php @@ -4,12 +4,14 @@ * * @author WooThemes * @package WooCommerce/Templates - * @version 2.1.0 + * @version 2.1.7 */ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly -global $woocommerce, $product, $post; +global $product, $post; + +$parent_product_post = $post; do_action( 'woocommerce_before_add_to_cart_form' ); ?> @@ -55,8 +57,9 @@ do_action( 'woocommerce_before_add_to_cart_form' ); ?> endforeach; // Reset to parent grouped product - wp_reset_postdata(); - $product = get_product( $post->ID ); + $post = $parent_product_post; + $product = get_product( $parent_product_post->ID ); + setup_postdata( $parent_product_post ); ?>