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..590be3a9bf2 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -11,7 +11,7 @@ GitHub is for _bug reports and contributions only_ - if you have a support quest - [WooExperts](https://woocommerce.com/experts/) - [Codeable](https://codeable.io/) -## Contributing To The Core +## Contributing to Core ### Reporting Issues @@ -78,7 +78,7 @@ We don’t have a Style Guide template available, so feel free to create your ow If you created a style guide for your language, please let us know so we can add it in the list above. You can also add it by yourself by submitting a PR for this file. -### Translating The Core +### Translating Core We have a [project on translate.wordpress.org](https://translate.wordpress.org/projects/wp-plugins/woocommerce). You can join the localization team of your language and help by translating WooCommerce. [Find more about using joining a language team and using GlotPress](https://make.wordpress.org/polyglots/handbook/tools/glotpress-translate-wordpress-org/). @@ -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 7d1b8f1e58c..df1522e3ae2 100644 --- a/readme.txt +++ b/readme.txt @@ -2,8 +2,8 @@ Contributors: automattic, mikejolley, jameskoster, claudiosanches, jshreve, coderkevin, claudiulodro, woothemes, iCaleb 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 +Tested up to: 4.8 +Stable tag: 3.0.8 License: GPLv3 License URI: https://www.gnu.org/licenses/gpl-3.0.html @@ -161,72 +161,72 @@ 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. -* Prices no longer display as 'free' instead of 0, to fix issues with ranges and localization and for consistency. -* 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-06-28 = +* Feature - Built-in product CSV importer and exporter for products. +* Feature - Display (toggle-able) terms inline on the checkout rather than showing a link. +* Feature - On the "pay for order" page, if logged out show a login form rather than an error message. +* Feature - Enabled oembed support for product short descriptions. +* Feature - Added bulk variation update for stock status. +* Feature - On customer profiles: added a button to copy billing address to shipping address. +* Feature - Setup Wizard - Automatic Shipping Zone Creation In Setup Wizard for the base location. +* Feature - Setup Wizard - Added a new optional Storefront Theme step if you're using a non-WooCommerce compatible theme. +* Feature - Made it possible to manage extension licenses purchased from WooCommerce.com on the extensions screen. +* Tweak - Gallery - Added a data-caption for captions to support both captions and titles for SEO. +* Tweak - Gallery - Used smoothHeight setting to better support images of different heights. +* Tweak - UI - Added blank states for API keys & webhooks. +* Tweak - UI - Made Product submenu labels consistent in admin. +* Tweak - UI - Changed street address field label and placeholder to minimize user error on checkout. +* Tweak - UI - Added a confirmation before deleting log files. +* Tweak - If prices are the same for all variations, use price not priceSpecification in structured data. +* Tweak - Added variable so shipping calculator is shown on first row only when showing multiple shipping packages. +* Tweak - Updated mini-cart HTML to use a list. +* Tweak - Allow linking to single product additional_information tab from url hash. +* Tweak - Re-included WooCommerce endpoints on the appearance > menus screens. +* Tweak - Always sync incorrect titles on variation read regardless of version. +* Tweak - Standardize rating HTML in all templates. +* Tweak - When searching, disable WC sort order so results are sorted by relevance. +* Tweak - Update price sorting code to use min or max for variable products depending on sorting direction. +* Tweak - Utilize $product method to get thumbnail in loops. +* Tweak - Check for an existing display name before updating a user on checkout. Adds display_name prop to the CRUD. +* Tweak - Adapt variable product price used in sorting based on direction of sort. +* Tweak - Made state validation less strict for keys. +* Tweak - For COD orders, force payment complete status to be completed. +* Fix - Use get_max_purchase_quantity in cart template and fix logic when stock management is off. +* Fix - Added log_id as the secondary sorting column to log list so log entries sort correctly. +* Fix - Fix shop page when using shop base and UTF8 shop page slug. +* Fix - Added handles so drag and drop does not break edit on mobile when sorting categories. +* Fix - Added ABSPATH checks to all files. +* Fix - Fixed how to flush rewrite rules after saving the shop main page. +* Fix - Emails sent via admin should switch to global locale. +* Fix - Set and restore wp_query so product page functions think it's a real product page. +* Fix - Variation default value of '0' fails to save on product. +* Fix - Prevent locations being added to the "Rest Of The World" shipping zone via the API. +* Dev - Made WC_Order get_item() method use caching, and fixed it to only return items from the actual order object being used. +* Dev - Allow date created to be set in wc_create_refund. +* Dev - Introduced a [WC_Order_Query class](https://github.com/woocommerce/woocommerce/wiki/wc_get_orders-and-WC_Order_Query) for finding/searching orders. +* Dev - Added "restored" webhook. +* Dev - Support floats for the custom attribute name sorting function. +* Dev - Updated Emogrifier to version 1.2. +* Dev - Sort product data tabs by priority in admin screen. +* Dev - Added new hooks for: dashboard reviews widget, product and category sorting events, woocommerce_add_to_cart_sold_individually_found_in_cart, cart empty messages. +* Dev - Added filters for zoom / flexslider / photoswipe enabling. +* Dev - Added filter for cookie name. +* Dev - Added ability to filter Photoswipe lightbox options. +* Dev - Added new filter for product thumbnail size. +* Dev - Added action for displaying custom data for fees in admin. +* Dev - Changed build_payload from private to public in webhook system. +* Dev - Added deprecated notice to WC_Order_Item_Meta (deprecated in 3.0). +* Dev - Added namespace to jQuery events that are removed in VariationForm. +* Dev - Made WC_Checkout::get_posted_data() public. +* Dev - Add custom message for custom system status tools. +* Dev - Added filters to change which order items are created and loaded to support custom item types. +* Dev - Updated jQuery payment and serializejson libraries. +* Localization - Added Bolivian states. +* Localization - Use VAT for Norway instead of Tax. [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 is a major update. Make a full site backup, 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-shipping.php b/templates/cart/cart-shipping.php index 654854fa492..bc8c05d4c33 100644 --- a/templates/cart/cart-shipping.php +++ b/templates/cart/cart-shipping.php @@ -15,7 +15,7 @@ * @see https://docs.woocommerce.com/document/template-structure/ * @author WooThemes * @package WooCommerce/Templates - * @version 2.5.0 + * @version 3.1.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; @@ -54,7 +54,7 @@ if ( ! defined( 'ABSPATH' ) ) { ' . esc_html( $package_details ) . '

'; ?> - + diff --git a/templates/cart/cart-totals.php b/templates/cart/cart-totals.php index d6f9591ad54..3084cee5215 100644 --- a/templates/cart/cart-totals.php +++ b/templates/cart/cart-totals.php @@ -21,7 +21,7 @@ if ( ! defined( 'ABSPATH' ) ) { } ?> -
+
diff --git a/templates/cart/cart.php b/templates/cart/cart.php index f82c47e0950..d458113d567 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.1.0 */ 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 ); @@ -107,7 +107,7 @@ do_action( 'woocommerce_before_cart' ); ?> $product_quantity = woocommerce_quantity_input( array( 'input_name' => "cart[{$cart_item_key}][qty]", 'input_value' => $cart_item['quantity'], - 'max_value' => $_product->backorders_allowed() ? '' : $_product->get_stock_quantity(), + 'max_value' => $_product->get_max_purchase_quantity(), 'min_value' => '0', ), $_product, false ); } @@ -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/cart/mini-cart.php b/templates/cart/mini-cart.php index cb1f91f101d..f1dd6e1a4a7 100644 --- a/templates/cart/mini-cart.php +++ b/templates/cart/mini-cart.php @@ -15,24 +15,20 @@ * @see https://docs.woocommerce.com/document/template-structure/ * @author WooThemes * @package WooCommerce/Templates - * @version 2.5.0 + * @version 3.1.0 */ - if ( ! defined( 'ABSPATH' ) ) { - exit; // Exit if accessed directly + exit; } -?> +do_action( 'woocommerce_before_mini_cart' ); ?> - - -
- -cart->is_empty() ) : ?> - -

: cart->get_cart_subtotal(); ?>

+

: cart->get_cart_subtotal(); ?>

-

- -

+

+ + + +

diff --git a/templates/cart/shipping-calculator.php b/templates/cart/shipping-calculator.php index 1bacd212b2f..08e7cf2aef8 100644 --- a/templates/cart/shipping-calculator.php +++ b/templates/cart/shipping-calculator.php @@ -38,8 +38,9 @@ if ( 'no' === get_option( 'woocommerce_enable_shipping_calc' ) || ! WC()->cart->

@@ -62,8 +63,9 @@ if ( 'no' === get_option( 'woocommerce_enable_shipping_calc' ) || ! WC()->cart-> get_checkout_fields( 'account' ) ) : ?> +customer->get_downloadable_products() ) : ?> ' . sprintf( _n( '%s download remaining', '%s downloads remaining', $download['downloads_remaining'], 'woocommerce' ), $download['downloads_remaining'] ) . ' ', $download ); + } echo apply_filters( 'woocommerce_available_download_link', '' . $download['download_name'] . '', $download ); 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..b0d811cfdbe 100644 --- a/templates/single-product/add-to-cart/grouped.php +++ b/templates/single-product/add-to-cart/grouped.php @@ -10,10 +10,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 - * @version 3.0.0 + * @see https://docs.woocommerce.com/document/template-structure/ + * @author WooThemes + * @package WooCommerce/Templates + * @version 3.0.7 */ if ( ! defined( 'ABSPATH' ) ) { exit; @@ -28,16 +28,17 @@ do_action( 'woocommerce_before_add_to_cart_form' ); ?> 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 ); + setup_postdata( $post =& $post_object ); ?> > - is_purchasable() ) : ?> + is_purchasable() || $grouped_product->has_options() ) : ?> is_sold_individually() ) : ?> @@ -66,7 +67,7 @@ do_action( 'woocommerce_before_add_to_cart_form' ); ?> @@ -79,7 +80,8 @@ do_action( 'woocommerce_before_add_to_cart_form' ); ?> diff --git a/templates/single-product/add-to-cart/variable.php b/templates/single-product/add-to-cart/variable.php index 2fae4efb744..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; 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' ) ) { ?>