From: Laury GvR Date: Thu, 21 Apr 2016 20:25:01 +0000 (-0400) Subject: No longer autoselect submitted value variation selection: X-Git-Tag: v1.0.0^2~9 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=f7766f3136b1996e5f1cf6db8559019e927e5aa2;p=WP-Themes%2Fjollylama.git No longer autoselect submitted value variation selection: --- diff --git a/functions.php b/functions.php index 429a06d..22f7ebe 100644 --- a/functions.php +++ b/functions.php @@ -167,7 +167,14 @@ remove_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_single_ remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_single_price', 40 ); add_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_single_price', 10 ); - +//addfilter('woocommercevariationpricehtml', 'myfunction', $product, 2); +// +//function myfunction($price, $product) { +// +//$price = getpostmeta( $product->variationid, 'regular_price'); +//// perform calculation on $price. +//return $price; +//} //remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 ); //add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 20 ); diff --git a/woocommerce/single-product/add-to-cart/variable.php b/woocommerce/single-product/add-to-cart/variable.php index 30d3f6e..8d57d1b 100644 --- a/woocommerce/single-product/add-to-cart/variable.php +++ b/woocommerce/single-product/add-to-cart/variable.php @@ -38,7 +38,8 @@ do_action( 'woocommerce_before_add_to_cart_form' ); ?> foreach ( $attributes as $attribute_name => $options ) : ob_start(); ?> - get_variation_default_attribute( $attribute_name ); + get_variation_default_attribute( $attribute_name ); + $selected = $product->get_variation_default_attribute( $attribute_name ); wc_dropdown_variation_attribute_options( array( 'options' => $options, 'attribute' => $attribute_name, 'product' => $product, 'selected' => $selected ) ); echo end( $attribute_keys ) === $attribute_name ? apply_filters( 'woocommerce_reset_variations_link', '' . __( 'Clear', 'woocommerce' ) . '' ) : ''; ?>