diff --git a/.babelrc b/.babelrc new file mode 100644 index 00000000000..47de40687da --- /dev/null +++ b/.babelrc @@ -0,0 +1,9 @@ +{ + "presets": [ + "es2015", + "stage-2" + ], + "plugins": [ + "add-module-exports" + ] +} diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index bbb79c4b372..97fcc742bbd 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -93,7 +93,7 @@ By translating video tutorials you'll be helping non-English speaking users and # Additional Resources * [General GitHub documentation](https://help.github.com/) -* [GitHub pull request documentation](https://help.github.com/send-pull-requests/) +* [GitHub pull request documentation](https://help.github.com/articles/about-pull-requests/) * [Translator Handbook](https://make.wordpress.org/polyglots/handbook/) * [WooCommerce Docs](https://docs.woocommerce.com/) * [WooCommerce Support](https://support.woocommerce.com) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 26962a4c3c4..0d1135a372b 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,16 +1,18 @@ -## EXPLANATION OF THE ISSUE +### EXPLANATION OF THE ISSUE -## STEPS TO REPRODUCE THE ISSUE +### STEPS TO REPRODUCE THE ISSUE -## SYSTEM STATUS REPORT +### SYSTEM STATUS +
``` -Grab the system status report from WooCommerce > System Status and paste it here. +Grab the system status report from WooCommerce > System Status and paste it here between the `details` tags. ``` +
+ diff --git a/readme.txt b/readme.txt index 12bf7c8aea1..7d0ec08e7eb 100644 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Contributors: automattic, mikejolley, jameskoster, claudiosanches, jshreve, code Tags: ecommerce, e-commerce, store, sales, sell, shop, cart, checkout, downloadable, downloads, paypal, storefront, woo commerce Requires at least: 4.4 Tested up to: 4.7 -Stable tag: 2.6.14 +Stable tag: 3.0.0 License: GPLv3 License URI: https://www.gnu.org/licenses/gpl-3.0.html @@ -161,71 +161,14 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woocommerce/wo == Changelog == -= 3.0.0 - 2017-04-04 = -* New gallery on single product pages with better mobile support, using PhotoSwipe and Zoom. Declare support with add_theme_support() - wc-product-gallery-zoom, wc-product-gallery-lightbox, wc-product-gallery-slider -* Made the store notice dismissible on the frontend. -* Variable products no longer show striked out prices in combination with ranges for clarity when on sale. -* Improved structured product data by using JSON-LD instead of inline Microdata. -* Improved downloads list layout (template file). -* Respect stock status and prevent the "out of stock threshold" setting affecting existing in-stock products. -* Improved handling of shop page rewrite rules to allow subpages. -* Redirect to login after password reset. -* When using authorizations in PayPal Standard, automatically capture funds when the order goes processing/completed. -* On multisite, when a user logs into a store with an account on a site, but not the current site, rather than error, add the user to the current site as a customer. -* Show variable weights/dimensions even when parent values are not set. -* Automatically sort tax rates rather than allow clunky manual sorting. -* When deleting a tax rate class, remove it's tax rates. -* Made WC_Logger pluggable via wc_get_logger function. -* Use 'average rating' post meta for 'rating' product sorting option. -* Show better labels in nav menus metabox. -* Sort “Recently Viewed” products by the view order. -* Removed internal scroll from log viewer. -* Add reply-to to admin emails. -* Improved the zone setup flow. -* Made wc_get_wildcard_postcodes return the orignal postcode plus * since wildcards should match empty strings too. -* Use all paid statuses in $customer->get_total_spent(). -* Move location of billing email field to work with password managers. -* Option to restrict selling locations by country. -* Added tool to clear orphaned variations in system status. -* Remove checkbox options in system status tools and replace with constants. -* Added security section in system status report. -* Add image_url setting to PayPal Standard. -* Fixed attribute registration. Attributes are non-hierarchical by default (parent is not supported). -* Add sort parameter to checkout fields to aid with sorting per locale. -* Merged percent and percent product coupon types (they provide the same discount). -* Prevent payment details being cleared after update_checkout events. -* Performance - Converted _featured and _visibility meta data to terms for faster catalog queries. Upgrade routine handles migration. Developers may need to update queries to reflect this change. -* Includes product attributes archives links in "Additional Information" tab. -* Select2 has been upgraded to v4. -* Improved logging system for extensions. -* Tax suffix is now hidden on non-taxable products. -* Performance - Converted rating filters to visibility terms. -* Performance - Added visibility term for outofstock products to speed those queries up also. -* Performance - Introduced a new CRUD (create, read, update, delete) system for Products, Orders, Customers and Shipping Zones. -* Performance - Optimised variable product sync. Upper/lower price meta is no longer stored, just the main prices, if a child has weight, and if a child has dimensions. -* Performance - Removed WP_Query from up-sells.php and related.php and replaced with PHP foreach loop (since we already have the product IDs). -* Performance - Removed the feature where old orders get access to new downloads on product edit. Looping potentially thousands of orders to do this is too much of a performance burden for stores and this can sometimes be unexpected behavior too. This does however updates *edited* downloads. -* Performance - Removed 'items' column on orders screen due to loading excessive data. -* Performance - Deferred email sending for faster checkouts. Now uses CRON. -* API - New Rest API v2 with support for meta_data amongst other things. -* API - Removed last order from customers part of the API due to performance concerns - use orders endpoint instead. Other order data on the endpoint is now transient cached. -* API - Allow oAuth1.0a authentication using headers. -* API - New Shipping Zones endpoints. -* API - New variations endpoints. -* API - New settings endpoints. -* API - Payment gateways and shipping methods endpoints. -* API - Prevented the (broken) ability to manipulate variations directly on the products endpoints. -* CLI - New CLI which uses the REST API endpoints rather than it's own functions. -* Localization - Improved RTL support. -* Localization - Added a language independent permalink setting function. -* Localization - Added inline comments for placeholder strings. -* Localization - Added Nigerian and Pakistan Provinces to i18n/state. -* Localization - US and Poland postcode validation. -* To read more about this release, see our dev blog announcement here: http://wp.me/p6wtcw-Uo += 3.1.0 - 2017-xx-xx = +* Included WooCommerce endpoints as options nav menu settings on Customize. +* Dev - Updated Emogrifier to version 1.2. +* Dev - Sort product data tabs by priority in admin screen. [See changelog for all versions](https://raw.githubusercontent.com/woocommerce/woocommerce/master/CHANGELOG.txt). == Upgrade Notice == -= 3.0 = -3.0 is a major update. It is important that you make backups and ensure themes and extensions are 3.0 compatible before upgrading. += 3.0.2 = +3.0 is a major update. [Make a full site backup](https://docs.woocommerce.com/document/backup-wordpress-content), update your theme and extensions, and [review update best practices](https://docs.woocommerce.com/document/how-to-update-your-site) before upgrading. diff --git a/templates/archive-product.php b/templates/archive-product.php index 9b2a7bc4287..ada4a8fbc5b 100644 --- a/templates/archive-product.php +++ b/templates/archive-product.php @@ -59,6 +59,7 @@ get_header( 'shop' ); ?> /** * woocommerce_before_shop_loop hook. * + * @hooked wc_print_notices - 10 * @hooked woocommerce_result_count - 20 * @hooked woocommerce_catalog_ordering - 30 */ diff --git a/templates/cart/cart-empty.php b/templates/cart/cart-empty.php index 964f696bf74..d0a37915d66 100644 --- a/templates/cart/cart-empty.php +++ b/templates/cart/cart-empty.php @@ -13,7 +13,7 @@ * @see https://docs.woocommerce.com/document/template-structure/ * @author WooThemes * @package WooCommerce/Templates - * @version 2.0.0 + * @version 3.1.0 */ if ( ! defined( 'ABSPATH' ) ) { @@ -22,15 +22,12 @@ if ( ! defined( 'ABSPATH' ) ) { wc_print_notices(); -?> +/** + * @hooked wc_empty_cart_message - 10 + */ +do_action( 'woocommerce_cart_is_empty' ); -

- -

- - - - 0 ) : ?> +if ( wc_get_page_id( 'shop' ) > 0 ) : ?>

diff --git a/templates/cart/cart.php b/templates/cart/cart.php index f82c47e0950..68e73a0552e 100644 --- a/templates/cart/cart.php +++ b/templates/cart/cart.php @@ -13,7 +13,7 @@ * @see https://docs.woocommerce.com/document/template-structure/ * @author WooThemes * @package WooCommerce/Templates - * @version 3.0.0 + * @version 3.0.3 */ if ( ! defined( 'ABSPATH' ) ) { @@ -75,7 +75,7 @@ do_action( 'woocommerce_before_cart' ); ?> ?> - + get_name(), $cart_item, $cart_item_key ) . ' '; @@ -93,13 +93,13 @@ do_action( 'woocommerce_before_cart' ); ?> ?> - + cart->get_product_price( $_product ), $cart_item, $cart_item_key ); ?> - + is_sold_individually() ) { $product_quantity = sprintf( '1 ', $cart_item_key ); @@ -116,7 +116,7 @@ do_action( 'woocommerce_before_cart' ); ?> ?> - + cart->get_product_subtotal( $_product, $cart_item['quantity'] ), $cart_item, $cart_item_key ); ?> @@ -154,7 +154,15 @@ do_action( 'woocommerce_before_cart' ); ?>

diff --git a/templates/checkout/form-billing.php b/templates/checkout/form-billing.php index a7b03fb4698..94b1c8a9850 100644 --- a/templates/checkout/form-billing.php +++ b/templates/checkout/form-billing.php @@ -13,7 +13,7 @@ * @see https://docs.woocommerce.com/document/template-structure/ * @author WooThemes * @package WooCommerce/Templates - * @version 2.1.2 + * @version 3.0.0 */ if ( ! defined( 'ABSPATH' ) ) { diff --git a/templates/checkout/form-shipping.php b/templates/checkout/form-shipping.php index 48adf96b718..e701cd0685f 100644 --- a/templates/checkout/form-shipping.php +++ b/templates/checkout/form-shipping.php @@ -13,7 +13,7 @@ * @see https://docs.woocommerce.com/document/template-structure/ * @author WooThemes * @package WooCommerce/Templates - * @version 2.2.0 + * @version 3.0.0 */ if ( ! defined( 'ABSPATH' ) ) { diff --git a/templates/content-product.php b/templates/content-product.php index 42ba59bee6f..bc8204642b8 100644 --- a/templates/content-product.php +++ b/templates/content-product.php @@ -13,7 +13,7 @@ * @see https://docs.woocommerce.com/document/template-structure/ * @author WooThemes * @package WooCommerce/Templates - * @version 2.6.1 + * @version 3.0.0 */ if ( ! defined( 'ABSPATH' ) ) { diff --git a/templates/content-single-product.php b/templates/content-single-product.php index 5058a1ffefc..31404e7bda4 100644 --- a/templates/content-single-product.php +++ b/templates/content-single-product.php @@ -13,7 +13,7 @@ * @see https://docs.woocommerce.com/document/template-structure/ * @author WooThemes * @package WooCommerce/Templates - * @version 1.6.4 + * @version 3.0.0 */ if ( ! defined( 'ABSPATH' ) ) { diff --git a/templates/emails/customer-on-hold-order.php b/templates/emails/customer-on-hold-order.php index b5a22691c7d..c766ab1b2f5 100644 --- a/templates/emails/customer-on-hold-order.php +++ b/templates/emails/customer-on-hold-order.php @@ -2,7 +2,7 @@ /** * Customer on-hold order email * - * This template can be overridden by copying it to yourtheme/woocommerce/emails/customer-processing-order.php. + * This template can be overridden by copying it to yourtheme/woocommerce/emails/customer-on-hold-order.php. * * HOWEVER, on occasion WooCommerce will need to update template files and you * (the theme developer) will need to copy the new files to your theme to diff --git a/templates/emails/email-addresses.php b/templates/emails/email-addresses.php index e6b06669af6..879123c9822 100644 --- a/templates/emails/email-addresses.php +++ b/templates/emails/email-addresses.php @@ -13,22 +13,24 @@ * @see https://docs.woocommerce.com/document/template-structure/ * @author WooThemes * @package WooCommerce/Templates/Emails - * @version 2.4.0 + * @version 3.0.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; } +$text_align = is_rtl() ? 'right' : 'left'; + ?> - needs_shipping_address() && ( $shipping = $order->get_formatted_shipping_address() ) ) : ?> -
+

get_formatted_billing_address(); ?>

+

diff --git a/templates/emails/email-customer-details.php b/templates/emails/email-customer-details.php index 7d71736ee6c..548dc75ff0f 100644 --- a/templates/emails/email-customer-details.php +++ b/templates/emails/email-customer-details.php @@ -12,10 +12,10 @@ * happen. When this occurs the version of the template file will be bumped and * the readme will list any important changes. * - * @see https://docs.woocommerce.com/document/template-structure/ - * @author WooThemes - * @package WooCommerce/Templates/Emails - * @version 2.5.0 + * @see https://docs.woocommerce.com/document/template-structure/ + * @author WooThemes + * @package WooCommerce/Templates/Emails + * @version 2.5.0 */ if ( ! defined( 'ABSPATH' ) ) { @@ -23,7 +23,7 @@ if ( ! defined( 'ABSPATH' ) ) { } ?> - +

    diff --git a/templates/emails/email-order-details.php b/templates/emails/email-order-details.php index 81552e5fdaf..29085ff34b7 100644 --- a/templates/emails/email-order-details.php +++ b/templates/emails/email-order-details.php @@ -13,13 +13,15 @@ * @see https://docs.woocommerce.com/document/template-structure/ * @author WooThemes * @package WooCommerce/Templates/Emails - * @version 2.5.0 + * @version 3.0.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; } +$text_align = is_rtl() ? 'right' : 'left'; + do_action( 'woocommerce_email_before_order_table', $order, $sent_to_admin, $plain_text, $email ); ?> @@ -31,9 +33,9 @@ do_action( 'woocommerce_email_before_order_table', $order, $sent_to_admin, $plai - - - + + + @@ -52,8 +54,8 @@ do_action( 'woocommerce_email_before_order_table', $order, $sent_to_admin, $plai foreach ( $totals as $total ) { $i++; ?> - - + + $item ) : if ( apply_filters( 'woocommerce_order_item_visible', true, $item ) ) { $product = $item->get_product(); ?> - - - + + get_purchase_note() ) ) : ?> - + diff --git a/templates/emails/email-styles.php b/templates/emails/email-styles.php index 1a8b3917aba..bc7ac31a30d 100644 --- a/templates/emails/email-styles.php +++ b/templates/emails/email-styles.php @@ -10,7 +10,7 @@ * happen. When this occurs the version of the template file will be bumped and * the readme will list any important changes. * - * @see https://docs.woocommerce.com/document/template-structure/ + * @see https://docs.woocommerce.com/document/template-structure/ * @author WooThemes * @package WooCommerce/Templates/Emails * @version 2.3.0 @@ -95,6 +95,22 @@ $text_lighter_20 = wc_hex_lighter( $text, 20 ); padding: 12px; } +#body_content td ul.wc-item-meta { + font-size: small; + margin: 1em 0 0; + padding: 0; + list-style: none; +} + +#body_content td ul.wc-item-meta li { + margin: 0.5em 0 0; + padding: 0; +} + +#body_content td ul.wc-item-meta li p { + margin: 0; +} + #body_content p { margin: 0 0 16px; } diff --git a/templates/emails/plain/customer-on-hold-order.php b/templates/emails/plain/customer-on-hold-order.php index ce2321eaf70..04bec34671a 100644 --- a/templates/emails/plain/customer-on-hold-order.php +++ b/templates/emails/plain/customer-on-hold-order.php @@ -2,7 +2,7 @@ /** * Customer on-hold order email * - * This template can be overridden by copying it to yourtheme/woocommerce/emails/plain/customer-processing-order.php. + * This template can be overridden by copying it to yourtheme/woocommerce/emails/plain/customer-on-hold-order.php. * * HOWEVER, on occasion WooCommerce will need to update template files and you * (the theme developer) will need to copy the new files to your theme to diff --git a/templates/loop/add-to-cart.php b/templates/loop/add-to-cart.php index 72702739a92..5a20a0cdb31 100644 --- a/templates/loop/add-to-cart.php +++ b/templates/loop/add-to-cart.php @@ -13,7 +13,7 @@ * @see https://docs.woocommerce.com/document/template-structure/ * @author WooThemes * @package WooCommerce/Templates - * @version 2.5.0 + * @version 3.0.0 */ if ( ! defined( 'ABSPATH' ) ) { diff --git a/templates/loop/rating.php b/templates/loop/rating.php index 2cfc0988a45..3018e4199d8 100644 --- a/templates/loop/rating.php +++ b/templates/loop/rating.php @@ -13,7 +13,7 @@ * @see https://docs.woocommerce.com/document/template-structure/ * @author WooThemes * @package WooCommerce/Templates - * @version 2.0.0 + * @version 3.0.0 */ if ( ! defined( 'ABSPATH' ) ) { diff --git a/templates/loop/result-count.php b/templates/loop/result-count.php index 81cd8678d71..c1b6c35af15 100644 --- a/templates/loop/result-count.php +++ b/templates/loop/result-count.php @@ -15,7 +15,7 @@ * @see https://docs.woocommerce.com/document/template-structure/ * @author WooThemes * @package WooCommerce/Templates - * @version 2.0.0 + * @version 3.0.0 */ if ( ! defined( 'ABSPATH' ) ) { @@ -40,7 +40,7 @@ if ( ! woocommerce_products_will_display() ) printf( _n( 'Showing the single result', 'Showing all %d results', $total, 'woocommerce' ), $total ); } else { /* translators: 1: first result 2: last result 3: total results */ - printf( _n( 'Showing the single result', 'Showing %1$d–%2$d of %3$d results', $total, 'woocommerce' ), $first, $last, $total ); + printf( _nx( 'Showing the single result', 'Showing %1$d–%2$d of %3$d results', $total, 'with first and last result', 'woocommerce' ), $first, $last, $total ); } ?>

    diff --git a/templates/myaccount/form-add-payment-method.php b/templates/myaccount/form-add-payment-method.php index eab01aa3e14..473e3ec9deb 100644 --- a/templates/myaccount/form-add-payment-method.php +++ b/templates/myaccount/form-add-payment-method.php @@ -13,7 +13,7 @@ * @see https://docs.woocommerce.com/document/template-structure/ * @author WooThemes * @package WooCommerce/Templates - * @version 2.6.0 + * @version 3.0.0 */ if ( ! defined( 'ABSPATH' ) ) { diff --git a/templates/myaccount/form-edit-address.php b/templates/myaccount/form-edit-address.php index 94796339808..d62f4892259 100644 --- a/templates/myaccount/form-edit-address.php +++ b/templates/myaccount/form-edit-address.php @@ -13,7 +13,7 @@ * @see https://docs.woocommerce.com/document/template-structure/ * @author WooThemes * @package WooCommerce/Templates - * @version 2.6.0 + * @version 3.0.0 */ if ( ! defined( 'ABSPATH' ) ) { diff --git a/templates/myaccount/form-lost-password.php b/templates/myaccount/form-lost-password.php index 34a205f8902..dc95c5dfeaf 100644 --- a/templates/myaccount/form-lost-password.php +++ b/templates/myaccount/form-lost-password.php @@ -13,7 +13,7 @@ * @see https://docs.woocommerce.com/document/template-structure/ * @author WooThemes * @package WooCommerce/Templates - * @version 2.6.0 + * @version 3.0.0 */ if ( ! defined( 'ABSPATH' ) ) { diff --git a/templates/myaccount/form-reset-password.php b/templates/myaccount/form-reset-password.php index b63c6399c83..b578fb49b1e 100644 --- a/templates/myaccount/form-reset-password.php +++ b/templates/myaccount/form-reset-password.php @@ -13,7 +13,7 @@ * @see https://docs.woocommerce.com/document/template-structure/ * @author WooThemes * @package WooCommerce/Templates - * @version 2.6.0 + * @version 3.0.0 */ if ( ! defined( 'ABSPATH' ) ) { diff --git a/templates/myaccount/orders.php b/templates/myaccount/orders.php index 6be8868d26c..528ac40adae 100644 --- a/templates/myaccount/orders.php +++ b/templates/myaccount/orders.php @@ -15,7 +15,7 @@ * @see https://docs.woocommerce.com/document/template-structure/ * @author WooThemes * @package WooCommerce/Templates - * @version 2.6.0 + * @version 3.0.0 */ if ( ! defined( 'ABSPATH' ) ) { diff --git a/templates/myaccount/view-order.php b/templates/myaccount/view-order.php index 88e5d6c2eaf..aeacc9e3b3b 100644 --- a/templates/myaccount/view-order.php +++ b/templates/myaccount/view-order.php @@ -15,7 +15,7 @@ * @see https://docs.woocommerce.com/document/template-structure/ * @author WooThemes * @package WooCommerce/Templates - * @version 2.6.0 + * @version 3.0.0 */ if ( ! defined( 'ABSPATH' ) ) { diff --git a/templates/single-product-reviews.php b/templates/single-product-reviews.php index e2c7b93298f..50d182d2ec1 100644 --- a/templates/single-product-reviews.php +++ b/templates/single-product-reviews.php @@ -89,14 +89,14 @@ if ( ! comments_open() ) { } if ( get_option( 'woocommerce_enable_review_rating' ) === 'yes' ) { - $comment_form['comment_field'] = '

    -

    '; + '; } $comment_form['comment_field'] .= '

    '; diff --git a/templates/single-product/add-to-cart/grouped.php b/templates/single-product/add-to-cart/grouped.php index 62aeefba128..acecf0ab88e 100644 --- a/templates/single-product/add-to-cart/grouped.php +++ b/templates/single-product/add-to-cart/grouped.php @@ -13,7 +13,7 @@ * @see https://docs.woocommerce.com/document/template-structure/ * @author WooThemes * @package WooCommerce/Templates - * @version 3.0.0 + * @version 3.0.3 */ if ( ! defined( 'ABSPATH' ) ) { exit; @@ -30,14 +30,14 @@ do_action( 'woocommerce_before_add_to_cart_form' ); ?> $quantites_required = false; foreach ( $grouped_products as $grouped_product ) { - $post_object = get_post( $grouped_product->get_id() ); - $quantites_required = $quantites_required || $grouped_product->is_purchasable(); + $post_object = get_post( $grouped_product->get_id() ); + $quantites_required = $quantites_required || ( $grouped_product->is_purchasable() && ! $grouped_product->has_options() ); setup_postdata( $GLOBALS['post'] =& $post_object ); ?> > diff --git a/templates/single-product/add-to-cart/variable.php b/templates/single-product/add-to-cart/variable.php index f5c127fa9a3..ac325c0770a 100644 --- a/templates/single-product/add-to-cart/variable.php +++ b/templates/single-product/add-to-cart/variable.php @@ -13,7 +13,7 @@ * @see https://docs.woocommerce.com/document/template-structure/ * @author WooThemes * @package WooCommerce/Templates - * @version 2.5.0 + * @version 3.0.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; @@ -38,7 +38,7 @@ do_action( 'woocommerce_before_add_to_cart_form' ); ?>
    ; vertical-align:middle; border: 1px solid #eee; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif; word-wrap:break-word;">' . esc_attr__( 'Product image', 'woocommerce' ) . '', $item ); + echo apply_filters( 'woocommerce_order_item_thumbnail', '
    ' . esc_attr__( 'Product image', 'woocommerce' ) . '
    ', $item ); } // Product name @@ -53,15 +55,15 @@ foreach ( $items as $item_id => $item ) : do_action( 'woocommerce_order_item_meta_end', $item_id, $item, $order, $plain_text ); ?>
    get_quantity(), $item ); ?>get_formatted_line_subtotal( $item ); ?>get_quantity(), $item ); ?>get_formatted_line_subtotal( $item ); ?>
    - is_purchasable() ) : ?> + is_purchasable() || $grouped_product->has_options() ) : ?> is_sold_individually() ) : ?> @@ -66,7 +66,7 @@ do_action( 'woocommerce_before_add_to_cart_form' ); ?> get_variation_default_attribute( $attribute_name ); + $selected = isset( $_REQUEST[ 'attribute_' . sanitize_title( $attribute_name ) ] ) ? wc_clean( stripslashes( urldecode( $_REQUEST[ 'attribute_' . sanitize_title( $attribute_name ) ] ) ) ) : $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', '' . esc_html__( 'Clear', 'woocommerce' ) . '' ) : ''; ?> diff --git a/templates/single-product/add-to-cart/variation-add-to-cart-button.php b/templates/single-product/add-to-cart/variation-add-to-cart-button.php index 9219e6cf260..1aa8ace21e8 100644 --- a/templates/single-product/add-to-cart/variation-add-to-cart-button.php +++ b/templates/single-product/add-to-cart/variation-add-to-cart-button.php @@ -21,7 +21,9 @@ global $product; do_action( 'woocommerce_before_add_to_cart_quantity' ); woocommerce_quantity_input( array( - 'input_value' => isset( $_POST['quantity'] ) ? wc_stock_amount( $_POST['quantity'] ) : 1, + 'min_value' => apply_filters( 'woocommerce_quantity_input_min', $product->get_min_purchase_quantity(), $product ), + 'max_value' => apply_filters( 'woocommerce_quantity_input_max', $product->get_max_purchase_quantity(), $product ), + 'input_value' => isset( $_POST['quantity'] ) ? wc_stock_amount( $_POST['quantity'] ) : $product->get_min_purchase_quantity(), ) ); /** diff --git a/templates/single-product/add-to-cart/variation.php b/templates/single-product/add-to-cart/variation.php index d0c3f4e159a..dd27206ed0a 100644 --- a/templates/single-product/add-to-cart/variation.php +++ b/templates/single-product/add-to-cart/variation.php @@ -16,7 +16,7 @@ if ( ! defined( 'ABSPATH' ) ) { ?>