From e1e2e2b6188621cd0e1a877a5846dc3d110bc569 Mon Sep 17 00:00:00 2001 From: lukecarbis Date: Tue, 15 Nov 2011 16:18:31 +1000 Subject: [PATCH] Added a selected_attributes variable, which uses the default attributes but also has a filter applied. --- woocommerce_template_functions.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/woocommerce_template_functions.php b/woocommerce_template_functions.php index 235ac37ca5c..057dd949e88 100644 --- a/woocommerce_template_functions.php +++ b/woocommerce_template_functions.php @@ -352,7 +352,8 @@ if (!function_exists('woocommerce_variable_add_to_cart')) { global $post, $_product, $woocommerce; $attributes = $_product->get_available_attribute_variations(); - $default_attributes = apply_filters( 'woocommerce_product_default_attributes', (array) maybe_unserialize(get_post_meta( $post->ID, '_default_attributes', true ))); + $default_attributes = (array) maybe_unserialize(get_post_meta( $post->ID, '_default_attributes', true )); + $selected_attributes = apply_filters( 'woocommerce_product_default_attributes', $default_attributes ); // Put available variations into an array and put in a Javascript variable (JSON encoded) $available_variations = array(); @@ -406,7 +407,7 @@ if (!function_exists('woocommerce_variable_add_to_cart')) { 'ASC');