From bfe327a83194e29a6ce7f14b04fdc993c1488620 Mon Sep 17 00:00:00 2001 From: Luis Date: Thu, 18 Apr 2019 23:39:36 -0300 Subject: [PATCH 001/361] Split widget code from HTML Split widget code from HTML. Added "translator" message to tell verb from noun. --- templates/class-wc-widget-price-filter.php | 159 +++++++++++++++++++++ templates/content-widget-price-filter.php | 40 ++++++ 2 files changed, 199 insertions(+) create mode 100644 templates/class-wc-widget-price-filter.php create mode 100644 templates/content-widget-price-filter.php diff --git a/templates/class-wc-widget-price-filter.php b/templates/class-wc-widget-price-filter.php new file mode 100644 index 00000000000..cc8c1994655 --- /dev/null +++ b/templates/class-wc-widget-price-filter.php @@ -0,0 +1,159 @@ +widget_cssclass = 'woocommerce widget_price_filter'; + $this->widget_description = __( 'Display a slider to filter products in your store by price.', 'woocommerce' ); + $this->widget_id = 'woocommerce_price_filter'; + $this->widget_name = __( 'Filter Products by Price', 'woocommerce' ); + $this->settings = array( + 'title' => array( + 'type' => 'text', + 'std' => __( 'Filter by price', 'woocommerce' ), + 'label' => __( 'Title', 'woocommerce' ), + ), + ); + $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; + wp_register_script( 'accounting', WC()->plugin_url() . '/assets/js/accounting/accounting' . $suffix . '.js', array( 'jquery' ), '0.4.2', true ); + wp_register_script( 'wc-jquery-ui-touchpunch', WC()->plugin_url() . '/assets/js/jquery-ui-touch-punch/jquery-ui-touch-punch' . $suffix . '.js', array( 'jquery-ui-slider' ), WC_VERSION, true ); + wp_register_script( 'wc-price-slider', WC()->plugin_url() . '/assets/js/frontend/price-slider' . $suffix . '.js', array( 'jquery-ui-slider', 'wc-jquery-ui-touchpunch', 'accounting' ), WC_VERSION, true ); + wp_localize_script( + 'wc-price-slider', + 'woocommerce_price_slider_params', + array( + 'currency_format_num_decimals' => 0, + 'currency_format_symbol' => get_woocommerce_currency_symbol(), + 'currency_format_decimal_sep' => esc_attr( wc_get_price_decimal_separator() ), + 'currency_format_thousand_sep' => esc_attr( wc_get_price_thousand_separator() ), + 'currency_format' => esc_attr( str_replace( array( '%1$s', '%2$s' ), array( '%s', '%v' ), get_woocommerce_price_format() ) ), + ) + ); + + if ( is_customize_preview() ) { + wp_enqueue_script( 'wc-price-slider' ); + } + + parent::__construct(); + } + + /** + * Output widget. + * + * @see WP_Widget + * + * @param array $args Arguments. + * @param array $instance Widget instance. + */ + public function widget( $args, $instance ) { + global $wp; + + if ( ! is_shop() && ! is_product_taxonomy() ) { + return; + } + + $min_price = isset( $_GET['min_price'] ) ? wc_clean( wp_unslash( $_GET['min_price'] ) ) : null; // WPCS: input var ok, CSRF ok. + $max_price = isset( $_GET['max_price'] ) ? wc_clean( wp_unslash( $_GET['max_price'] ) ) : null; // WPCS: input var ok, CSRF ok. + if ( ! wc()->query->get_main_query()->post_count && null === $min_price && null === $max_price ) { + return; + } + + wp_enqueue_script( 'wc-price-slider' ); + + // Find min and max price in current result set. + $prices = $this->get_filtered_price(); + $min = floor( $prices->min_price ); + $max = ceil( $prices->max_price ); + + if ( $min === $max ) { + return; + } + + $this->widget_start( $args, $instance ); + + if ( '' === get_option( 'permalink_structure' ) ) { + $form_action = remove_query_arg( array( 'page', 'paged', 'product-page' ), add_query_arg( $wp->query_string, '', home_url( $wp->request ) ) ); + } else { + $form_action = preg_replace( '%\/page/[0-9]+%', '', home_url( trailingslashit( $wp->request ) ) ); + } + + $min_price = null !== $min_price ? $min_price : apply_filters( 'woocommerce_price_filter_widget_min_amount', $min ); + $max_price = null !== $max_price ? $max_price : apply_filters( 'woocommerce_price_filter_widget_max_amount', $max ); + + wc_get_template( 'content-widget-price-filter.php', array( + 'form_action' => $form_action, + 'min' => $min, + 'max' => $max, + 'min_price' => $min_price, + 'max_price' => $max_price, + ) ); + + $this->widget_end( $args ); + } + + /** + * Get filtered min price for current products. + * + * @return int + */ + protected function get_filtered_price() { + global $wpdb; + + $args = wc()->query->get_main_query()->query_vars; + $tax_query = isset( $args['tax_query'] ) ? $args['tax_query'] : array(); + $meta_query = isset( $args['meta_query'] ) ? $args['meta_query'] : array(); + + if ( ! is_post_type_archive( 'product' ) && ! empty( $args['taxonomy'] ) && ! empty( $args['term'] ) ) { + $tax_query[] = array( + 'taxonomy' => $args['taxonomy'], + 'terms' => array( $args['term'] ), + 'field' => 'slug', + ); + } + + foreach ( $meta_query + $tax_query as $key => $query ) { + if ( ! empty( $query['price_filter'] ) || ! empty( $query['rating_filter'] ) ) { + unset( $meta_query[ $key ] ); + } + } + + $meta_query = new WP_Meta_Query( $meta_query ); + $tax_query = new WP_Tax_Query( $tax_query ); + + $meta_query_sql = $meta_query->get_sql( 'post', $wpdb->posts, 'ID' ); + $tax_query_sql = $tax_query->get_sql( $wpdb->posts, 'ID' ); + + $sql = "SELECT min( FLOOR( price_meta.meta_value ) ) as min_price, max( CEILING( price_meta.meta_value ) ) as max_price FROM {$wpdb->posts} "; + $sql .= " LEFT JOIN {$wpdb->postmeta} as price_meta ON {$wpdb->posts}.ID = price_meta.post_id " . $tax_query_sql['join'] . $meta_query_sql['join']; + $sql .= " WHERE {$wpdb->posts}.post_type IN ('" . implode( "','", array_map( 'esc_sql', apply_filters( 'woocommerce_price_filter_post_type', array( 'product' ) ) ) ) . "') + AND {$wpdb->posts}.post_status = 'publish' + AND price_meta.meta_key IN ('" . implode( "','", array_map( 'esc_sql', apply_filters( 'woocommerce_price_filter_meta_keys', array( '_price' ) ) ) ) . "') + AND price_meta.meta_value > '' "; + $sql .= $tax_query_sql['where'] . $meta_query_sql['where']; + + $search = WC_Query::get_main_search_query_sql(); + if ( $search ) { + $sql .= ' AND ' . $search; + } + + $sql = apply_filters( 'woocommerce_price_filter_sql', $sql, $meta_query_sql, $tax_query_sql ); + + return $wpdb->get_row( $sql ); // WPCS: unprepared SQL ok. + } +} diff --git a/templates/content-widget-price-filter.php b/templates/content-widget-price-filter.php new file mode 100644 index 00000000000..6400567ba95 --- /dev/null +++ b/templates/content-widget-price-filter.php @@ -0,0 +1,40 @@ + + + +
+
+ +
+ + + + + + +
+
+
+
+ + From e9131fa90970736c46fdff315f29eef81cd270f1 Mon Sep 17 00:00:00 2001 From: Luis Date: Thu, 18 Apr 2019 23:57:35 -0300 Subject: [PATCH 002/361] Uploaded file to the wrong place --- templates/class-wc-widget-price-filter.php | 159 --------------------- 1 file changed, 159 deletions(-) delete mode 100644 templates/class-wc-widget-price-filter.php diff --git a/templates/class-wc-widget-price-filter.php b/templates/class-wc-widget-price-filter.php deleted file mode 100644 index cc8c1994655..00000000000 --- a/templates/class-wc-widget-price-filter.php +++ /dev/null @@ -1,159 +0,0 @@ -widget_cssclass = 'woocommerce widget_price_filter'; - $this->widget_description = __( 'Display a slider to filter products in your store by price.', 'woocommerce' ); - $this->widget_id = 'woocommerce_price_filter'; - $this->widget_name = __( 'Filter Products by Price', 'woocommerce' ); - $this->settings = array( - 'title' => array( - 'type' => 'text', - 'std' => __( 'Filter by price', 'woocommerce' ), - 'label' => __( 'Title', 'woocommerce' ), - ), - ); - $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; - wp_register_script( 'accounting', WC()->plugin_url() . '/assets/js/accounting/accounting' . $suffix . '.js', array( 'jquery' ), '0.4.2', true ); - wp_register_script( 'wc-jquery-ui-touchpunch', WC()->plugin_url() . '/assets/js/jquery-ui-touch-punch/jquery-ui-touch-punch' . $suffix . '.js', array( 'jquery-ui-slider' ), WC_VERSION, true ); - wp_register_script( 'wc-price-slider', WC()->plugin_url() . '/assets/js/frontend/price-slider' . $suffix . '.js', array( 'jquery-ui-slider', 'wc-jquery-ui-touchpunch', 'accounting' ), WC_VERSION, true ); - wp_localize_script( - 'wc-price-slider', - 'woocommerce_price_slider_params', - array( - 'currency_format_num_decimals' => 0, - 'currency_format_symbol' => get_woocommerce_currency_symbol(), - 'currency_format_decimal_sep' => esc_attr( wc_get_price_decimal_separator() ), - 'currency_format_thousand_sep' => esc_attr( wc_get_price_thousand_separator() ), - 'currency_format' => esc_attr( str_replace( array( '%1$s', '%2$s' ), array( '%s', '%v' ), get_woocommerce_price_format() ) ), - ) - ); - - if ( is_customize_preview() ) { - wp_enqueue_script( 'wc-price-slider' ); - } - - parent::__construct(); - } - - /** - * Output widget. - * - * @see WP_Widget - * - * @param array $args Arguments. - * @param array $instance Widget instance. - */ - public function widget( $args, $instance ) { - global $wp; - - if ( ! is_shop() && ! is_product_taxonomy() ) { - return; - } - - $min_price = isset( $_GET['min_price'] ) ? wc_clean( wp_unslash( $_GET['min_price'] ) ) : null; // WPCS: input var ok, CSRF ok. - $max_price = isset( $_GET['max_price'] ) ? wc_clean( wp_unslash( $_GET['max_price'] ) ) : null; // WPCS: input var ok, CSRF ok. - if ( ! wc()->query->get_main_query()->post_count && null === $min_price && null === $max_price ) { - return; - } - - wp_enqueue_script( 'wc-price-slider' ); - - // Find min and max price in current result set. - $prices = $this->get_filtered_price(); - $min = floor( $prices->min_price ); - $max = ceil( $prices->max_price ); - - if ( $min === $max ) { - return; - } - - $this->widget_start( $args, $instance ); - - if ( '' === get_option( 'permalink_structure' ) ) { - $form_action = remove_query_arg( array( 'page', 'paged', 'product-page' ), add_query_arg( $wp->query_string, '', home_url( $wp->request ) ) ); - } else { - $form_action = preg_replace( '%\/page/[0-9]+%', '', home_url( trailingslashit( $wp->request ) ) ); - } - - $min_price = null !== $min_price ? $min_price : apply_filters( 'woocommerce_price_filter_widget_min_amount', $min ); - $max_price = null !== $max_price ? $max_price : apply_filters( 'woocommerce_price_filter_widget_max_amount', $max ); - - wc_get_template( 'content-widget-price-filter.php', array( - 'form_action' => $form_action, - 'min' => $min, - 'max' => $max, - 'min_price' => $min_price, - 'max_price' => $max_price, - ) ); - - $this->widget_end( $args ); - } - - /** - * Get filtered min price for current products. - * - * @return int - */ - protected function get_filtered_price() { - global $wpdb; - - $args = wc()->query->get_main_query()->query_vars; - $tax_query = isset( $args['tax_query'] ) ? $args['tax_query'] : array(); - $meta_query = isset( $args['meta_query'] ) ? $args['meta_query'] : array(); - - if ( ! is_post_type_archive( 'product' ) && ! empty( $args['taxonomy'] ) && ! empty( $args['term'] ) ) { - $tax_query[] = array( - 'taxonomy' => $args['taxonomy'], - 'terms' => array( $args['term'] ), - 'field' => 'slug', - ); - } - - foreach ( $meta_query + $tax_query as $key => $query ) { - if ( ! empty( $query['price_filter'] ) || ! empty( $query['rating_filter'] ) ) { - unset( $meta_query[ $key ] ); - } - } - - $meta_query = new WP_Meta_Query( $meta_query ); - $tax_query = new WP_Tax_Query( $tax_query ); - - $meta_query_sql = $meta_query->get_sql( 'post', $wpdb->posts, 'ID' ); - $tax_query_sql = $tax_query->get_sql( $wpdb->posts, 'ID' ); - - $sql = "SELECT min( FLOOR( price_meta.meta_value ) ) as min_price, max( CEILING( price_meta.meta_value ) ) as max_price FROM {$wpdb->posts} "; - $sql .= " LEFT JOIN {$wpdb->postmeta} as price_meta ON {$wpdb->posts}.ID = price_meta.post_id " . $tax_query_sql['join'] . $meta_query_sql['join']; - $sql .= " WHERE {$wpdb->posts}.post_type IN ('" . implode( "','", array_map( 'esc_sql', apply_filters( 'woocommerce_price_filter_post_type', array( 'product' ) ) ) ) . "') - AND {$wpdb->posts}.post_status = 'publish' - AND price_meta.meta_key IN ('" . implode( "','", array_map( 'esc_sql', apply_filters( 'woocommerce_price_filter_meta_keys', array( '_price' ) ) ) ) . "') - AND price_meta.meta_value > '' "; - $sql .= $tax_query_sql['where'] . $meta_query_sql['where']; - - $search = WC_Query::get_main_search_query_sql(); - if ( $search ) { - $sql .= ' AND ' . $search; - } - - $sql = apply_filters( 'woocommerce_price_filter_sql', $sql, $meta_query_sql, $tax_query_sql ); - - return $wpdb->get_row( $sql ); // WPCS: unprepared SQL ok. - } -} From 99d85a2c027160e867cce1c9100b2110dfc00613 Mon Sep 17 00:00:00 2001 From: Luis Date: Fri, 19 Apr 2019 00:18:24 -0300 Subject: [PATCH 003/361] Changing HTML string to template call template/content-widget-price-filter.php --- .../widgets/class-wc-widget-price-filter.php | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/includes/widgets/class-wc-widget-price-filter.php b/includes/widgets/class-wc-widget-price-filter.php index 463c87ee2a4..09bc664a305 100644 --- a/includes/widgets/class-wc-widget-price-filter.php +++ b/includes/widgets/class-wc-widget-price-filter.php @@ -120,21 +120,14 @@ class WC_Widget_Price_Filter extends WC_Widget { $form_action = preg_replace( '%\/page/[0-9]+%', '', home_url( trailingslashit( $wp->request ) ) ); } - echo '
-
- -
- - - - - ' . wc_query_string_form_fields( null, array( 'min_price', 'max_price', 'paged' ), '', true ) . ' -
-
-
-
'; // WPCS: XSS ok. + wc_get_template( 'content-widget-price-filter.php', array( + 'form_action' => $form_action, + 'step' => $step, + 'min_price' => $min_price, + 'max_price' => $max_price, + 'current_min_price' => $current_min_price, + 'current_max_price' => $current_max_price + ) ); $this->widget_end( $args ); } From fb776534232a3cd2bc98abf7f80019c151f2078c Mon Sep 17 00:00:00 2001 From: Luis Date: Fri, 19 Apr 2019 00:19:43 -0300 Subject: [PATCH 004/361] Updating with newest version of WC --- templates/content-widget-price-filter.php | 27 +++++++++++------------ 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/templates/content-widget-price-filter.php b/templates/content-widget-price-filter.php index 6400567ba95..a71ecdcd692 100644 --- a/templates/content-widget-price-filter.php +++ b/templates/content-widget-price-filter.php @@ -21,20 +21,19 @@ defined( 'ABSPATH' ) || exit;
-
- -
- - - - - - -
-
-
+
+ +
+ + + + + +
+
+
From 7abe7e5712a1c0629d7c34bfe76ce9979ad5def8 Mon Sep 17 00:00:00 2001 From: Sandro Dzneladze Date: Tue, 14 May 2019 15:54:01 +0400 Subject: [PATCH 005/361] Normalize register/login submit button css classes --- templates/myaccount/form-login.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/myaccount/form-login.php b/templates/myaccount/form-login.php index 560001ffef0..e99c551eb94 100644 --- a/templates/myaccount/form-login.php +++ b/templates/myaccount/form-login.php @@ -104,7 +104,7 @@ do_action( 'woocommerce_before_customer_login_form' ); ?>

- +

From dce3f4907f0154a268f5f1f0ab6d40b420db2f97 Mon Sep 17 00:00:00 2001 From: aslamshekh Date: Mon, 24 Jun 2019 18:58:20 +0530 Subject: [PATCH 006/361] Fix - 23913, Delete product query transients when removing terms via wp_remove_object_terms() --- includes/class-wc-post-data.php | 1 + 1 file changed, 1 insertion(+) diff --git a/includes/class-wc-post-data.php b/includes/class-wc-post-data.php index 74162a22b1e..f083e59415e 100644 --- a/includes/class-wc-post-data.php +++ b/includes/class-wc-post-data.php @@ -30,6 +30,7 @@ class WC_Post_Data { add_action( 'shutdown', array( __CLASS__, 'do_deferred_product_sync' ), 10 ); add_action( 'set_object_terms', array( __CLASS__, 'force_default_term' ), 10, 5 ); add_action( 'set_object_terms', array( __CLASS__, 'delete_product_query_transients' ) ); + add_action( 'delete_term_relationships', array( __CLASS__, 'delete_product_query_transients' ) ); add_action( 'woocommerce_product_set_stock_status', array( __CLASS__, 'delete_product_query_transients' ) ); add_action( 'woocommerce_product_set_visibility', array( __CLASS__, 'delete_product_query_transients' ) ); add_action( 'woocommerce_product_type_changed', array( __CLASS__, 'product_type_changed' ), 10, 3 ); From 3945694e37152d6b77e1fe2d362a11e54d59ce31 Mon Sep 17 00:00:00 2001 From: Kris Shannon Date: Thu, 27 Jun 2019 18:40:39 +1000 Subject: [PATCH 007/361] Force string comparison for customer_id In 203dba5 a check against the current user id was introduced. This check is always failing because of a type mismatch causing an unnecessary insert/update query against the database. --- includes/class-wc-session-handler.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/class-wc-session-handler.php b/includes/class-wc-session-handler.php index 4d2a8a9e316..04f6c7b4534 100644 --- a/includes/class-wc-session-handler.php +++ b/includes/class-wc-session-handler.php @@ -93,8 +93,8 @@ class WC_Session_Handler extends WC_Session { $this->_data = $this->get_session_data(); // If the user logs in, update session. - if ( is_user_logged_in() && get_current_user_id() !== $this->_customer_id ) { - $this->_customer_id = get_current_user_id(); + if ( is_user_logged_in() && strval( get_current_user_id() ) !== $this->_customer_id ) { + $this->_customer_id = strval( get_current_user_id() ); $this->_dirty = true; $this->save_data(); $this->set_customer_session_cookie( true ); @@ -172,7 +172,7 @@ class WC_Session_Handler extends WC_Session { $customer_id = ''; if ( is_user_logged_in() ) { - $customer_id = get_current_user_id(); + $customer_id = strval( get_current_user_id() ); } if ( empty( $customer_id ) ) { From 687197f234ce96c4eec2ee2715240d9a48ab2ab1 Mon Sep 17 00:00:00 2001 From: rgjchandler Date: Mon, 15 Jul 2019 16:00:13 +0100 Subject: [PATCH 008/361] Fix #24153 - Added filter to disable password change notification --- includes/shortcodes/class-wc-shortcode-my-account.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/includes/shortcodes/class-wc-shortcode-my-account.php b/includes/shortcodes/class-wc-shortcode-my-account.php index 3099aaba0a7..e6306225319 100644 --- a/includes/shortcodes/class-wc-shortcode-my-account.php +++ b/includes/shortcodes/class-wc-shortcode-my-account.php @@ -376,7 +376,9 @@ class WC_Shortcode_My_Account { wp_set_password( $new_pass, $user->ID ); self::set_reset_password_cookie(); - wp_password_change_notification( $user ); + if ( ! apply_filters( 'woocommerce_disable_password_change_notification', false ) ) { + wp_password_change_notification( $user ); + } } /** From 052a6c6489669558ccb877fc5845d8d50bbbd6ff Mon Sep 17 00:00:00 2001 From: John <11445928+johncodeos@users.noreply.github.com> Date: Tue, 16 Jul 2019 02:23:59 +0300 Subject: [PATCH 009/361] Hide Vietnam's state field When you choose the country 'Vietnam' from a woocommerce website, the state field is hidden. So I added to be hidden in this class too. --- includes/class-wc-countries.php | 1 + 1 file changed, 1 insertion(+) diff --git a/includes/class-wc-countries.php b/includes/class-wc-countries.php index 1abcf8258ed..1d762bf3abe 100644 --- a/includes/class-wc-countries.php +++ b/includes/class-wc-countries.php @@ -1244,6 +1244,7 @@ class WC_Countries { 'VN' => array( 'state' => array( 'required' => false, + 'hidden' => true, ), 'postcode' => array( 'priority' => 65, From 354b248b28a66e540a7c9de0c2ffc77cfcd19a58 Mon Sep 17 00:00:00 2001 From: Chris Eich Date: Mon, 15 Jul 2019 21:59:02 -0700 Subject: [PATCH 010/361] Only count orders created via checkout in held stock qty Plugins may create orders without the meta tag "_created_via"="checkout" for various purposes, e.g. a balance-due order for purchases via deposit, because only the deposit order should reduce stock on checkout. The SUMO Payment Plans plugin does exactly this, but core WC handles such orders inconsistently: - wc_get_held_stock_quantity() counts their items against held stock, but - wc_cancel_unpaid_orders() only cancels old orders with a meta tag of "_created_via"="checkout" This PR fixes that inconsistency, which on my site was preventing a user from adding an in-stock product to her cart, just because a balance-due order for the same product was pending. Workaround: clear the setting WC > Products > Inventory > Hold Time (default 60 minutes), which inhibits the use of wc_get_held_stock_quantity(). --- includes/wc-stock-functions.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/includes/wc-stock-functions.php b/includes/wc-stock-functions.php index ad068c41401..8097590b569 100644 --- a/includes/wc-stock-functions.php +++ b/includes/wc-stock-functions.php @@ -307,12 +307,15 @@ function wc_get_held_stock_quantity( $product, $exclude_order_id = 0 ) { " SELECT SUM( order_item_meta.meta_value ) AS held_qty FROM {$wpdb->posts} AS posts + LEFT JOIN {$wpdb->postmeta} as postmeta ON posts.ID = postmeta.post_id LEFT JOIN {$wpdb->prefix}woocommerce_order_items as order_items ON posts.ID = order_items.order_id LEFT JOIN {$wpdb->prefix}woocommerce_order_itemmeta as order_item_meta ON order_items.order_item_id = order_item_meta.order_item_id LEFT JOIN {$wpdb->prefix}woocommerce_order_itemmeta as order_item_meta2 ON order_items.order_item_id = order_item_meta2.order_item_id WHERE order_item_meta.meta_key = '_qty' AND order_item_meta2.meta_key = %s AND order_item_meta2.meta_value = %d + AND postmeta.meta_key = '_created_via' + AND postmeta.meta_value = 'checkout' AND posts.post_type IN ( '" . implode( "','", wc_get_order_types() ) . "' ) AND posts.post_status = 'wc-pending' AND posts.ID != %d;", From 1ada2e849126ba48c3b15a49c6f595c52a830ee5 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Tue, 16 Jul 2019 15:32:10 -0300 Subject: [PATCH 011/361] Use "Go to the shop" in downloads --- templates/myaccount/downloads.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/myaccount/downloads.php b/templates/myaccount/downloads.php index 856df37a872..7e0f6ca8193 100644 --- a/templates/myaccount/downloads.php +++ b/templates/myaccount/downloads.php @@ -12,7 +12,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/ * @package WooCommerce/Templates * @version 3.2.0 */ @@ -37,7 +37,7 @@ do_action( 'woocommerce_before_account_downloads', $has_downloads ); ?> From 50d9c7380938698af0bfa4d7c5b71ae53b88409f Mon Sep 17 00:00:00 2001 From: David Stone Date: Mon, 15 Jul 2019 17:19:20 -0600 Subject: [PATCH 012/361] Add more specific reason for why products cannot be purchased so plugin can custimize these messages --- includes/abstracts/abstract-wc-product.php | 20 ++++++++++++++++++++ includes/class-wc-cart-session.php | 7 +++---- includes/class-wc-cart.php | 2 +- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/includes/abstracts/abstract-wc-product.php b/includes/abstracts/abstract-wc-product.php index 9403817a637..ca62a337380 100644 --- a/includes/abstracts/abstract-wc-product.php +++ b/includes/abstracts/abstract-wc-product.php @@ -1507,6 +1507,26 @@ class WC_Product extends WC_Abstract_Legacy_Product { return apply_filters( 'woocommerce_is_purchasable', $this->exists() && ( 'publish' === $this->get_status() || current_user_can( 'edit_post', $this->get_id() ) ) && '' !== $this->get_price(), $this ); } + /** + * Get a user friendly message about why an item is not purchasable. + * + * @return string + */ + public function get_unable_to_purchase_message() { + if ( ! $this->exists() ) { + $message = __( 'Sorry, this product cannot be purchased because it does not exist.', 'woocommerce' ); + } elseif( 'publish' !== $this->get_status() && ! current_user_can( 'edit_post', $this->get_id() ) ) { + $message = __( 'Sorry, this product cannot be purchased because it has been removed.', 'woocommerce'); + } elseif( '' === $this->get_price() ) { + $message = __( 'Sorry, this product cannot be purchased because it has no price set.', 'woocommerce' ); + } else { + // Some other reason probably related to a plugin. + $message = __( 'Sorry, this product cannot be purchased.', 'woocommerce' ); + } + + return apply_filters( 'woocommerce_is_purchasable_message', $message, $this ); + } + /** * Returns whether or not the product is on sale. * diff --git a/includes/class-wc-cart-session.php b/includes/class-wc-cart-session.php index 66a3ed94366..56676f09249 100644 --- a/includes/class-wc-cart-session.php +++ b/includes/class-wc-cart-session.php @@ -130,10 +130,9 @@ final class WC_Cart_Session { } elseif ( ! $product->is_purchasable() ) { $update_cart_session = true; - /* translators: %s: product name */ - wc_add_notice( sprintf( __( '%s has been removed from your cart because it can no longer be purchased. Please contact us if you need assistance.', 'woocommerce' ), $product->get_name() ), 'error' ); - do_action( 'woocommerce_remove_cart_item_from_session', $key, $values ); - + /* translators: %1$s: product name. %2$s reason why */ + wc_add_notice( sprintf( __( '%s has been removed from your cart because it can no longer be purchased. Please contact us if you need assistance.', 'woocommerce' ), $product->get_name() ), 'error' ); do_action( 'woocommerce_remove_cart_item_from_session', $key, $values ); + wc_add_notice( $product->get_unable_to_purchase_message(), 'error' ); } elseif ( ! empty( $values['data_hash'] ) && ! hash_equals( $values['data_hash'], wc_get_cart_item_data_hash( $product ) ) ) { // phpcs:ignore PHPCompatibility.PHP.NewFunctions.hash_equalsFound $update_cart_session = true; /* translators: %1$s: product name. %2$s product permalink */ diff --git a/includes/class-wc-cart.php b/includes/class-wc-cart.php index f06e6f57d25..fcfd5563543 100644 --- a/includes/class-wc-cart.php +++ b/includes/class-wc-cart.php @@ -1044,7 +1044,7 @@ class WC_Cart extends WC_Legacy_Cart { } if ( ! $product_data->is_purchasable() ) { - throw new Exception( __( 'Sorry, this product cannot be purchased.', 'woocommerce' ) ); + throw new Exception( $product_data->get_unable_to_purchase_message() ); } // Stock check - only check if we're managing stock and backorders are not allowed. From b2e262f6cc733afc39ba9673cdde1c8253622a57 Mon Sep 17 00:00:00 2001 From: David Stone Date: Tue, 16 Jul 2019 17:14:02 -0600 Subject: [PATCH 013/361] Add more specific errors for all product type which are unpurchasable --- includes/class-wc-product-external.php | 9 +++++++++ includes/class-wc-product-grouped.php | 10 ++++++++++ includes/class-wc-product-variation.php | 17 +++++++++++++++++ 3 files changed, 36 insertions(+) diff --git a/includes/class-wc-product-external.php b/includes/class-wc-product-external.php index b99f10b90bc..30622ea17a4 100644 --- a/includes/class-wc-product-external.php +++ b/includes/class-wc-product-external.php @@ -151,6 +151,15 @@ class WC_Product_External extends WC_Product { return apply_filters( 'woocommerce_is_purchasable', false, $this ); } + /** + * Get a user friendly message about why an item is not purchasable. + * + * @return string + */ + public function get_unable_to_purchase_message() { + return __( 'Sorry, this external product cannot be purchased here.', 'woocommerce' ); + } + /** * Get the add to url used mainly in loops. * diff --git a/includes/class-wc-product-grouped.php b/includes/class-wc-product-grouped.php index e2b19d0419c..d3b037b821a 100644 --- a/includes/class-wc-product-grouped.php +++ b/includes/class-wc-product-grouped.php @@ -82,6 +82,16 @@ class WC_Product_Grouped extends WC_Product { return apply_filters( 'woocommerce_is_purchasable', false, $this ); } + /** + * Get a user friendly message about why an item is not purchasable. + * + * @return string + */ + public function get_unable_to_purchase_message() { + + return __( 'Sorry, this grouped product cannot be purchased individually.'); + } + /** * Returns the price in html format. * diff --git a/includes/class-wc-product-variation.php b/includes/class-wc-product-variation.php index d3b159f60df..a8f902ed2f6 100644 --- a/includes/class-wc-product-variation.php +++ b/includes/class-wc-product-variation.php @@ -547,6 +547,23 @@ class WC_Product_Variation extends WC_Product_Simple { return apply_filters( 'woocommerce_variation_is_purchasable', $this->variation_is_visible() && parent::is_purchasable() && ( 'publish' === $this->parent_data['status'] || current_user_can( 'edit_post', $this->get_parent_id() ) ), $this ); } + /** + * Get a user friendly message about why an item is not purchasable. + * Override abstract so the error can be more precise. + * + * @return string + */ + public function get_unable_to_purchase_message() { + if ( ! $this->variation_is_visible() ) { + $message = __( 'Sorry, this product variation cannot be purchased because it is disabled.', 'woocommerce' ); + } elseif( 'publish' === $this->parent_data['status'] || current_user_can( 'edit_post', $this->get_parent_id() ) ) { + $message = __( 'Sorry, this product variation cannot be purchased because its parent has been removed.', 'woocommerce'); + } else { + $message = parent::get_unable_to_purchase_message(); + } + return $message; + } + /** * Controls whether this particular variation will appear greyed-out (inactive) or not (active). * Used by extensions to make incompatible variations appear greyed-out, etc. From 0e317ac82ee0774aaaf8d4f2b739e0e73a0a2ff7 Mon Sep 17 00:00:00 2001 From: Rodrigo Primo Date: Thu, 18 Jul 2019 10:24:42 -0300 Subject: [PATCH 014/361] Only add the image node to structured data if product has image This commit adds a check to verify if a given product has a image before adding the image node to the structured data output. If there is no image, the image node should be omitted instead of display with `false` as its value. --- includes/class-wc-structured-data.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/includes/class-wc-structured-data.php b/includes/class-wc-structured-data.php index 7ccf3e12bc1..5518a651ac2 100644 --- a/includes/class-wc-structured-data.php +++ b/includes/class-wc-structured-data.php @@ -194,16 +194,20 @@ class WC_Structured_Data { $shop_url = home_url(); $currency = get_woocommerce_currency(); $permalink = get_permalink( $product->get_id() ); + $image = wp_get_attachment_url( $product->get_image_id() ); $markup = array( '@type' => 'Product', '@id' => $permalink . '#product', // Append '#product' to differentiate between this @id and the @id generated for the Breadcrumblist. 'name' => $product->get_name(), 'url' => $permalink, - 'image' => wp_get_attachment_url( $product->get_image_id() ), 'description' => wp_strip_all_tags( do_shortcode( $product->get_short_description() ? $product->get_short_description() : $product->get_description() ) ), ); + if ( $image ) { + $markup['image'] = $image; + } + // Declare SKU or fallback to ID. if ( $product->get_sku() ) { $markup['sku'] = $product->get_sku(); From fd42c439f91cc9714542843ba1bf5b5f150e4b85 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Thu, 18 Jul 2019 23:34:13 -0300 Subject: [PATCH 015/361] Prevent run wc_load_cart() before woocommerce_loaded --- includes/wc-core-functions.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/includes/wc-core-functions.php b/includes/wc-core-functions.php index dbdcb2fbfe3..d1e6c100793 100644 --- a/includes/wc-core-functions.php +++ b/includes/wc-core-functions.php @@ -2263,6 +2263,12 @@ function wc_get_server_database_version() { * @return void */ function wc_load_cart() { + if ( ! did_action( 'woocommerce_loaded' ) ) { + /* translators: 1: wc_get_product 2: woocommerce_init */ + wc_doing_it_wrong( __FUNCTION__, sprintf( __( '%1$s should not be called before the %2$s action.', 'woocommerce' ), 'wc_load_cart', 'woocommerce_init' ), '3.7' ); + return; + } + WC()->initialize_session(); WC()->initialize_cart(); } From 488eefd7ecda2c44ff0f1d920f1986d9f4ae6e99 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Thu, 18 Jul 2019 23:43:32 -0300 Subject: [PATCH 016/361] Don't allow before before_woocommerce_init --- includes/wc-core-functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/wc-core-functions.php b/includes/wc-core-functions.php index d1e6c100793..f7899e2f681 100644 --- a/includes/wc-core-functions.php +++ b/includes/wc-core-functions.php @@ -2263,7 +2263,7 @@ function wc_get_server_database_version() { * @return void */ function wc_load_cart() { - if ( ! did_action( 'woocommerce_loaded' ) ) { + if ( ! did_action( 'before_woocommerce_init' ) || doing_action( 'before_woocommerce_init' ) ) { /* translators: 1: wc_get_product 2: woocommerce_init */ wc_doing_it_wrong( __FUNCTION__, sprintf( __( '%1$s should not be called before the %2$s action.', 'woocommerce' ), 'wc_load_cart', 'woocommerce_init' ), '3.7' ); return; From 040a617cd1828017913a39d81ae8154a4e85df16 Mon Sep 17 00:00:00 2001 From: MahdiY Date: Fri, 19 Jul 2019 09:35:04 +0430 Subject: [PATCH 017/361] Add filter hook to get zone criteria --- includes/data-stores/class-wc-shipping-zone-data-store.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/includes/data-stores/class-wc-shipping-zone-data-store.php b/includes/data-stores/class-wc-shipping-zone-data-store.php index 7e95335b770..c526b2fb113 100644 --- a/includes/data-stores/class-wc-shipping-zone-data-store.php +++ b/includes/data-stores/class-wc-shipping-zone-data-store.php @@ -254,6 +254,8 @@ class WC_Shipping_Zone_Data_Store extends WC_Data_Store_WP implements WC_Shippin $criteria[] = $wpdb->prepare( "OR ( location_type = 'continent' AND location_code = %s )", $continent ); $criteria[] = 'OR ( location_type IS NULL ) )'; + $criteria = apply_filters( 'woocommerce_get_zone_criteria', $criteria, $package ); + // Postcode range and wildcard matching. $postcode_locations = $wpdb->get_results( "SELECT zone_id, location_code FROM {$wpdb->prefix}woocommerce_shipping_zone_locations WHERE location_type = 'postcode';" ); From f22dbd53ffe7f0da104a6f19883f1d0b87a88b1c Mon Sep 17 00:00:00 2001 From: rmalviya Date: Fri, 19 Jul 2019 15:52:06 +0530 Subject: [PATCH 018/361] Parse attribute_id as int not string In legacy API v3 for product attribute terms, the `$attribute_id` is received as string, but is required as int for proper handling. Use `absint` to make sure it is a valid int id and hence fix #24160. --- includes/legacy/api/v3/class-wc-api-products.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/includes/legacy/api/v3/class-wc-api-products.php b/includes/legacy/api/v3/class-wc-api-products.php index 8f084074078..4d16aa42b98 100644 --- a/includes/legacy/api/v3/class-wc-api-products.php +++ b/includes/legacy/api/v3/class-wc-api-products.php @@ -2752,6 +2752,7 @@ class WC_API_Products extends WC_API_Resource { throw new WC_API_Exception( 'woocommerce_api_user_cannot_read_product_attribute_terms', __( 'You do not have permission to read product attribute terms', 'woocommerce' ), 401 ); } + $attribute_id = absint( $attribute_id ); $taxonomy = wc_attribute_taxonomy_name_by_id( $attribute_id ); if ( ! $taxonomy ) { @@ -2792,6 +2793,7 @@ class WC_API_Products extends WC_API_Resource { try { $id = absint( $id ); + $attribute_id = absint( $attribute_id ); // Validate ID if ( empty( $id ) ) { From 94d0516ba219eb715836190d1eba4fb8c92a3980 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Fri, 19 Jul 2019 13:29:38 -0300 Subject: [PATCH 019/361] Fixed translator notation --- includes/wc-core-functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/wc-core-functions.php b/includes/wc-core-functions.php index f7899e2f681..d2eda3aa143 100644 --- a/includes/wc-core-functions.php +++ b/includes/wc-core-functions.php @@ -2264,7 +2264,7 @@ function wc_get_server_database_version() { */ function wc_load_cart() { if ( ! did_action( 'before_woocommerce_init' ) || doing_action( 'before_woocommerce_init' ) ) { - /* translators: 1: wc_get_product 2: woocommerce_init */ + /* translators: 1: wc_load_cart 2: woocommerce_init */ wc_doing_it_wrong( __FUNCTION__, sprintf( __( '%1$s should not be called before the %2$s action.', 'woocommerce' ), 'wc_load_cart', 'woocommerce_init' ), '3.7' ); return; } From db089c3f9d76516a3861aa470728733e1615dc19 Mon Sep 17 00:00:00 2001 From: David Stone Date: Fri, 19 Jul 2019 15:37:10 -0600 Subject: [PATCH 020/361] Only use default message to avoid showing too much information to user --- includes/abstracts/abstract-wc-product.php | 20 -------------------- includes/class-wc-cart-session.php | 7 +++++-- includes/class-wc-cart.php | 5 ++++- includes/class-wc-product-external.php | 9 --------- includes/class-wc-product-grouped.php | 10 ---------- includes/class-wc-product-variation.php | 17 ----------------- 6 files changed, 9 insertions(+), 59 deletions(-) diff --git a/includes/abstracts/abstract-wc-product.php b/includes/abstracts/abstract-wc-product.php index ca62a337380..9403817a637 100644 --- a/includes/abstracts/abstract-wc-product.php +++ b/includes/abstracts/abstract-wc-product.php @@ -1507,26 +1507,6 @@ class WC_Product extends WC_Abstract_Legacy_Product { return apply_filters( 'woocommerce_is_purchasable', $this->exists() && ( 'publish' === $this->get_status() || current_user_can( 'edit_post', $this->get_id() ) ) && '' !== $this->get_price(), $this ); } - /** - * Get a user friendly message about why an item is not purchasable. - * - * @return string - */ - public function get_unable_to_purchase_message() { - if ( ! $this->exists() ) { - $message = __( 'Sorry, this product cannot be purchased because it does not exist.', 'woocommerce' ); - } elseif( 'publish' !== $this->get_status() && ! current_user_can( 'edit_post', $this->get_id() ) ) { - $message = __( 'Sorry, this product cannot be purchased because it has been removed.', 'woocommerce'); - } elseif( '' === $this->get_price() ) { - $message = __( 'Sorry, this product cannot be purchased because it has no price set.', 'woocommerce' ); - } else { - // Some other reason probably related to a plugin. - $message = __( 'Sorry, this product cannot be purchased.', 'woocommerce' ); - } - - return apply_filters( 'woocommerce_is_purchasable_message', $message, $this ); - } - /** * Returns whether or not the product is on sale. * diff --git a/includes/class-wc-cart-session.php b/includes/class-wc-cart-session.php index 56676f09249..eadd82d3cb1 100644 --- a/includes/class-wc-cart-session.php +++ b/includes/class-wc-cart-session.php @@ -131,8 +131,11 @@ final class WC_Cart_Session { } elseif ( ! $product->is_purchasable() ) { $update_cart_session = true; /* translators: %1$s: product name. %2$s reason why */ - wc_add_notice( sprintf( __( '%s has been removed from your cart because it can no longer be purchased. Please contact us if you need assistance.', 'woocommerce' ), $product->get_name() ), 'error' ); do_action( 'woocommerce_remove_cart_item_from_session', $key, $values ); - wc_add_notice( $product->get_unable_to_purchase_message(), 'error' ); + $message = sprintf( __( '%s has been removed from your cart because it can no longer be purchased. Please contact us if you need assistance.', 'woocommerce' ), $product->get_name() ); + $message = apply_filters( 'woocommerce_is_not_purchasable_message', $message, $product, 'get_cart_from_session' ); + wc_add_notice( $message, 'error' ); + do_action( 'woocommerce_remove_cart_item_from_session', $key, $values ); + } elseif ( ! empty( $values['data_hash'] ) && ! hash_equals( $values['data_hash'], wc_get_cart_item_data_hash( $product ) ) ) { // phpcs:ignore PHPCompatibility.PHP.NewFunctions.hash_equalsFound $update_cart_session = true; /* translators: %1$s: product name. %2$s product permalink */ diff --git a/includes/class-wc-cart.php b/includes/class-wc-cart.php index fcfd5563543..98776551105 100644 --- a/includes/class-wc-cart.php +++ b/includes/class-wc-cart.php @@ -1044,7 +1044,10 @@ class WC_Cart extends WC_Legacy_Cart { } if ( ! $product_data->is_purchasable() ) { - throw new Exception( $product_data->get_unable_to_purchase_message() ); + $message = __( 'Sorry, this product cannot be purchased.', 'woocommerce' ); + + $message = apply_filters( 'woocommerce_is_not_purchasable_message', $message, $product_data, 'add_to_cart' ); + throw new Exception( $message ); } // Stock check - only check if we're managing stock and backorders are not allowed. diff --git a/includes/class-wc-product-external.php b/includes/class-wc-product-external.php index 30622ea17a4..b99f10b90bc 100644 --- a/includes/class-wc-product-external.php +++ b/includes/class-wc-product-external.php @@ -151,15 +151,6 @@ class WC_Product_External extends WC_Product { return apply_filters( 'woocommerce_is_purchasable', false, $this ); } - /** - * Get a user friendly message about why an item is not purchasable. - * - * @return string - */ - public function get_unable_to_purchase_message() { - return __( 'Sorry, this external product cannot be purchased here.', 'woocommerce' ); - } - /** * Get the add to url used mainly in loops. * diff --git a/includes/class-wc-product-grouped.php b/includes/class-wc-product-grouped.php index d3b037b821a..e2b19d0419c 100644 --- a/includes/class-wc-product-grouped.php +++ b/includes/class-wc-product-grouped.php @@ -82,16 +82,6 @@ class WC_Product_Grouped extends WC_Product { return apply_filters( 'woocommerce_is_purchasable', false, $this ); } - /** - * Get a user friendly message about why an item is not purchasable. - * - * @return string - */ - public function get_unable_to_purchase_message() { - - return __( 'Sorry, this grouped product cannot be purchased individually.'); - } - /** * Returns the price in html format. * diff --git a/includes/class-wc-product-variation.php b/includes/class-wc-product-variation.php index a8f902ed2f6..d3b159f60df 100644 --- a/includes/class-wc-product-variation.php +++ b/includes/class-wc-product-variation.php @@ -547,23 +547,6 @@ class WC_Product_Variation extends WC_Product_Simple { return apply_filters( 'woocommerce_variation_is_purchasable', $this->variation_is_visible() && parent::is_purchasable() && ( 'publish' === $this->parent_data['status'] || current_user_can( 'edit_post', $this->get_parent_id() ) ), $this ); } - /** - * Get a user friendly message about why an item is not purchasable. - * Override abstract so the error can be more precise. - * - * @return string - */ - public function get_unable_to_purchase_message() { - if ( ! $this->variation_is_visible() ) { - $message = __( 'Sorry, this product variation cannot be purchased because it is disabled.', 'woocommerce' ); - } elseif( 'publish' === $this->parent_data['status'] || current_user_can( 'edit_post', $this->get_parent_id() ) ) { - $message = __( 'Sorry, this product variation cannot be purchased because its parent has been removed.', 'woocommerce'); - } else { - $message = parent::get_unable_to_purchase_message(); - } - return $message; - } - /** * Controls whether this particular variation will appear greyed-out (inactive) or not (active). * Used by extensions to make incompatible variations appear greyed-out, etc. From 0e316c238d11f96e897a7376912dcd5e32caf0de Mon Sep 17 00:00:00 2001 From: Gerhard Date: Mon, 22 Jul 2019 14:11:11 +0200 Subject: [PATCH 021/361] Add back WC_Tax::maybe_remove_tax_class_rates removed in #23093 and deprecate it instead. --- includes/class-wc-tax.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/includes/class-wc-tax.php b/includes/class-wc-tax.php index 1e9cc3148b3..65a6909372c 100644 --- a/includes/class-wc-tax.php +++ b/includes/class-wc-tax.php @@ -36,6 +36,17 @@ class WC_Tax { self::$round_at_subtotal = 'yes' === get_option( 'woocommerce_tax_round_at_subtotal' ); } + /** + * When the woocommerce_tax_classes option is changed, remove any orphan rates. + * + * @deprecated 3.7.0 + * @param string $old_value Old rates value. + * @param string $value New rates value. + */ + public static function maybe_remove_tax_class_rates( $old_value, $value ) { + wc_deprecated_function( 'WC_Tax::maybe_remove_tax_class_rates', '3.7' ); + } + /** * Calculate tax for a line. * From e586379c3c40b99e768e31afc7167d819bfb91cc Mon Sep 17 00:00:00 2001 From: Gerhard Date: Mon, 22 Jul 2019 14:16:17 +0200 Subject: [PATCH 022/361] Delete woocommerce_tax_classes option after transfering it to the new tax class table. --- includes/wc-update-functions.php | 1 + 1 file changed, 1 insertion(+) diff --git a/includes/wc-update-functions.php b/includes/wc-update-functions.php index 8c42a2b0ef6..93047b9d35e 100644 --- a/includes/wc-update-functions.php +++ b/includes/wc-update-functions.php @@ -1993,6 +1993,7 @@ function wc_update_370_tax_rate_classes() { WC_Tax::create_tax_class( $class ); } } + delete_option( 'woocommerce_tax_classes' ); } /** From 487b38e0ae6a896b8b43015c39bdf9d5cfe297fb Mon Sep 17 00:00:00 2001 From: David Stone Date: Wed, 24 Jul 2019 16:54:51 -0600 Subject: [PATCH 023/361] Use two different filters instead to avoid unexpected behavior --- includes/class-wc-cart-session.php | 9 ++++++++- includes/class-wc-cart.php | 10 ++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/includes/class-wc-cart-session.php b/includes/class-wc-cart-session.php index eadd82d3cb1..45a68537926 100644 --- a/includes/class-wc-cart-session.php +++ b/includes/class-wc-cart-session.php @@ -132,7 +132,14 @@ final class WC_Cart_Session { $update_cart_session = true; /* translators: %1$s: product name. %2$s reason why */ $message = sprintf( __( '%s has been removed from your cart because it can no longer be purchased. Please contact us if you need assistance.', 'woocommerce' ), $product->get_name() ); - $message = apply_filters( 'woocommerce_is_not_purchasable_message', $message, $product, 'get_cart_from_session' ); + /** + * Filter message about item removed from the cart. + * + * @since 3.8.0 + * @param string $message Message. + * @param WC_Product $product Product data. + */ + $message = apply_filters( 'woocommerce_cart_item_removed_message', $message, $product ); wc_add_notice( $message, 'error' ); do_action( 'woocommerce_remove_cart_item_from_session', $key, $values ); diff --git a/includes/class-wc-cart.php b/includes/class-wc-cart.php index 98776551105..03145295646 100644 --- a/includes/class-wc-cart.php +++ b/includes/class-wc-cart.php @@ -1045,8 +1045,14 @@ class WC_Cart extends WC_Legacy_Cart { if ( ! $product_data->is_purchasable() ) { $message = __( 'Sorry, this product cannot be purchased.', 'woocommerce' ); - - $message = apply_filters( 'woocommerce_is_not_purchasable_message', $message, $product_data, 'add_to_cart' ); + /** + * Filters message about product unable to be purchased. + * + * @since 3.8.0 + * @param string $message Message. + * @param WC_Product $product_data Product data. + */ + $message = apply_filters( 'woocommerce_cart_product_cannot_be_purchased_message', $message, $product_data ); throw new Exception( $message ); } From 57f2cfafd4e836b59e86f7d30205989d12b163ba Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Thu, 25 Jul 2019 05:07:55 +0000 Subject: [PATCH 024/361] Update dependency lint-staged to v9.2.1 --- package-lock.json | 181 ++++++++++++++++++++++++++++++++++++++-------- package.json | 2 +- 2 files changed, 150 insertions(+), 33 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1d40af5db51..a130f73d438 100644 --- a/package-lock.json +++ b/package-lock.json @@ -266,12 +266,40 @@ "glob-to-regexp": "^0.3.0" } }, + "@nodelib/fs.scandir": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.1.tgz", + "integrity": "sha512-NT/skIZjgotDSiXs0WqYhgcuBKhUMgfekCmCGtkUAiLqZdOnrdjmZr9wRl3ll64J9NF79uZ4fk16Dx0yMc/Xbg==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "2.0.1", + "run-parallel": "^1.1.9" + }, + "dependencies": { + "@nodelib/fs.stat": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.1.tgz", + "integrity": "sha512-+RqhBlLn6YRBGOIoVYthsG0J9dfpO79eJyN7BYBkZJtfqrBwf2KK+rD/M/yjZR6WBmIhAgOV7S60eCgaSWtbFw==", + "dev": true + } + } + }, "@nodelib/fs.stat": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz", "integrity": "sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw==", "dev": true }, + "@nodelib/fs.walk": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.2.tgz", + "integrity": "sha512-J/DR3+W12uCzAJkw7niXDcqcKBg6+5G5Q/ZpThpGNzAUz70eOR6RV4XnnSN01qHZiVl0eavoxJsBypQoKsV2QQ==", + "dev": true, + "requires": { + "@nodelib/fs.scandir": "2.1.1", + "fastq": "^1.6.0" + } + }, "@samverschueren/stream-to-observable": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/@samverschueren/stream-to-observable/-/stream-to-observable-0.3.0.tgz", @@ -3927,6 +3955,15 @@ "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", "dev": true }, + "fastq": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.6.0.tgz", + "integrity": "sha512-jmxqQ3Z/nXoeyDmWAzF9kH1aGZSis6e/SbfPmJpUnyZ0ogr6iscHQaml4wsEepEWSdtmpy+eVXmCRIMpxaXqOA==", + "dev": true, + "requires": { + "reusify": "^1.0.0" + } + }, "fault": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/fault/-/fault-1.0.2.tgz", @@ -6915,9 +6952,9 @@ "dev": true }, "lint-staged": { - "version": "9.2.0", - "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-9.2.0.tgz", - "integrity": "sha512-K/CQWcxYunc8lGMNTFvtI4+ybJcHW3K4Ghudz2OrJhIWdW/i1WWu9rGiVj4yJ0+D/xh8a08kp5slt89VZC9Eqg==", + "version": "9.2.1", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-9.2.1.tgz", + "integrity": "sha512-3lGgJfBddCy/WndKdNko+uJbwyYjBD1k+V+SA+phBYWzH265S95KQya/Wln/UL+hOjc7NcjtFYVCUWuAcqYHhg==", "dev": true, "requires": { "chalk": "^2.4.2", @@ -6925,8 +6962,8 @@ "cosmiconfig": "^5.2.1", "debug": "^4.1.1", "dedent": "^0.7.0", - "del": "^4.1.1", - "execa": "^2.0.1", + "del": "^5.0.0", + "execa": "^2.0.3", "listr": "^0.14.3", "log-symbols": "^3.0.0", "micromatch": "^4.0.2", @@ -6935,6 +6972,18 @@ "stringify-object": "^3.3.0" }, "dependencies": { + "@nodelib/fs.stat": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.1.tgz", + "integrity": "sha512-+RqhBlLn6YRBGOIoVYthsG0J9dfpO79eJyN7BYBkZJtfqrBwf2KK+rD/M/yjZR6WBmIhAgOV7S60eCgaSWtbFw==", + "dev": true + }, + "array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true + }, "braces": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", @@ -6966,20 +7015,27 @@ } }, "del": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/del/-/del-4.1.1.tgz", - "integrity": "sha512-QwGuEUouP2kVwQenAsOof5Fv8K9t3D8Ca8NxcXKrIpEHjTXK5J2nXLdP+ALI1cgv8wj7KuwBhTwBkOZSJKM5XQ==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/del/-/del-5.0.0.tgz", + "integrity": "sha512-TfU3nUY0WDIhN18eq+pgpbLY9AfL5RfiE9czKaTSolc6aK7qASXfDErvYgjV1UqCR4sNXDoxO0/idPmhDUt2Sg==", "dev": true, "requires": { - "@types/glob": "^7.1.1", - "globby": "^6.1.0", + "globby": "^10.0.0", "is-path-cwd": "^2.0.0", "is-path-in-cwd": "^2.0.0", "p-map": "^2.0.0", - "pify": "^4.0.1", "rimraf": "^2.6.3" } }, + "dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "requires": { + "path-type": "^4.0.0" + } + }, "execa": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/execa/-/execa-2.0.3.tgz", @@ -6997,6 +7053,20 @@ "strip-final-newline": "^2.0.0" } }, + "fast-glob": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.0.4.tgz", + "integrity": "sha512-wkIbV6qg37xTJwqSsdnIphL1e+LaGz4AIQqr00mIubMaEhv1/HEmJ0uuCGZRNRUkZZmOB5mJKO0ZUTVq+SxMQg==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "^2.0.1", + "@nodelib/fs.walk": "^1.2.1", + "glob-parent": "^5.0.0", + "is-glob": "^4.0.1", + "merge2": "^1.2.3", + "micromatch": "^4.0.2" + } + }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -7015,6 +7085,37 @@ "pump": "^3.0.0" } }, + "glob-parent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.0.0.tgz", + "integrity": "sha512-Z2RwiujPRGluePM6j699ktJYxmPpJKCfpGA13jz2hmFZC7gKetzrWvg5KN3+OsIFmydGyZ1AVwERCq1w/ZZwRg==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, + "globby": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/globby/-/globby-10.0.1.tgz", + "integrity": "sha512-sSs4inE1FB2YQiymcmTv6NWENryABjUNPeWhOvmn4SjtKybglsyPZxFB3U1/+L1bYi0rNZDqCLlHyLYDl1Pq5A==", + "dev": true, + "requires": { + "@types/glob": "^7.1.1", + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.0.3", + "glob": "^7.1.3", + "ignore": "^5.1.1", + "merge2": "^1.2.3", + "slash": "^3.0.0" + } + }, + "ignore": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.2.tgz", + "integrity": "sha512-vdqWBp7MyzdmHkkRWV5nY+PfGRbYbahfuvsBCh277tq+w9zyNi7h5CYJCK0kmzti9kU+O/cB7sE8HvKv6aXAKQ==", + "dev": true + }, "import-fresh": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-2.0.0.tgz", @@ -7025,6 +7126,21 @@ "resolve-from": "^3.0.0" } }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-glob": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", + "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, "is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", @@ -7138,10 +7254,10 @@ "integrity": "sha512-8cChqz0RP6SHJkMt48FW0A7+qUOn+OsnOsVtzI59tZ8m+5bCSk7hzwET0pulwOM2YMn9J1efb07KB9l9f30SGg==", "dev": true }, - "pify": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", - "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", + "path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", "dev": true }, "resolve-from": { @@ -7150,6 +7266,12 @@ "integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=", "dev": true }, + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true + }, "to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -9887,6 +10009,12 @@ "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", "dev": true }, + "reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true + }, "rimraf": { "version": "2.6.3", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", @@ -9946,6 +10074,12 @@ "integrity": "sha512-kc120TBlQ3mih1LSzdAJXo4xn/GWS2ec0l3S+syHDXP9uRr0JAT8Qd3mdMuyjqCzeZktgP3try92cEgf9Nks8A==", "dev": true }, + "run-parallel": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.1.9.tgz", + "integrity": "sha512-DEqnSRTDw/Tc3FXf49zedI638Z9onwUotBMiUFKmrO2sdFKIbXamXGQ3Axd4qgphxKB4kw/qP1w5kTxnfU1B9Q==", + "dev": true + }, "rx-lite": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/rx-lite/-/rx-lite-3.1.2.tgz", @@ -11965,23 +12099,6 @@ "requires": { "string-width": "^2.1.1", "strip-ansi": "^4.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } - } } }, "wrappy": { diff --git a/package.json b/package.json index b40ed21035b..98d026aa4e4 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "grunt-wp-i18n": "1.0.3", "husky": "3.0.1", "istanbul": "1.0.0-alpha.2", - "lint-staged": "9.2.0", + "lint-staged": "9.2.1", "mocha": "6.2.0", "node-sass": "4.12.0", "prettier": "github:automattic/calypso-prettier#c56b4251", From bb2c929fbae78947ac6b4d8dd6a79ff642f4de1a Mon Sep 17 00:00:00 2001 From: rspublishing Date: Thu, 25 Jul 2019 09:31:37 +0200 Subject: [PATCH 025/361] Use in woocommerce_update_product_stock_query --- includes/data-stores/class-wc-product-data-store-cpt.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/data-stores/class-wc-product-data-store-cpt.php b/includes/data-stores/class-wc-product-data-store-cpt.php index 61d765c35bf..7b1e67ea376 100644 --- a/includes/data-stores/class-wc-product-data-store-cpt.php +++ b/includes/data-stores/class-wc-product-data-store-cpt.php @@ -1384,7 +1384,7 @@ class WC_Product_Data_Store_CPT extends WC_Data_Store_WP implements WC_Object_Da $product_id_with_stock ); - $sql = apply_filters( 'woocommerce_update_product_stock_query', $sql, $product_id_with_stock, $stock_quantity, 'set' ); + $sql = apply_filters( 'woocommerce_update_product_stock_query', $sql, $product_id_with_stock, $new_stock, 'set' ); $wpdb->query( $sql ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.PreparedSQL.NotPrepared From f4bfc15ef29db4a2a680285e370f5655ac48a070 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Thu, 25 Jul 2019 15:28:48 +0000 Subject: [PATCH 026/361] Update dependency woocommerce/woocommerce-blocks to v2.3.0-beta.2 --- composer.json | 2 +- composer.lock | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/composer.json b/composer.json index fb60f00df33..98d4367bb47 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ "automattic/jetpack-autoloader": "1.2.0", "php": ">=5.6|>=7.0", "composer/installers": "1.6.0", - "woocommerce/woocommerce-blocks": "2.3.0-beta", + "woocommerce/woocommerce-blocks": "2.3.0-beta.2", "woocommerce/woocommerce-rest-api": "1.0.3" }, "require-dev": { diff --git a/composer.lock b/composer.lock index eb3e061e38a..50585b6f748 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "8b2833a3907261e9b1fb056fe56c9dfb", + "content-hash": "8b88f3c424707ce9ffe80b4fe6e600a5", "packages": [ { "name": "automattic/jetpack-autoloader", @@ -164,16 +164,16 @@ }, { "name": "woocommerce/woocommerce-blocks", - "version": "v2.3.0-beta", + "version": "v2.3.0-beta.2", "source": { "type": "git", "url": "https://github.com/woocommerce/woocommerce-gutenberg-products-block.git", - "reference": "00b6d8fefd62e6fe8b14fdb277dc784ff108291e" + "reference": "6894c51726556d3c9b30fe7da1681904cef057a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/woocommerce/woocommerce-gutenberg-products-block/zipball/00b6d8fefd62e6fe8b14fdb277dc784ff108291e", - "reference": "00b6d8fefd62e6fe8b14fdb277dc784ff108291e", + "url": "https://api.github.com/repos/woocommerce/woocommerce-gutenberg-products-block/zipball/6894c51726556d3c9b30fe7da1681904cef057a2", + "reference": "6894c51726556d3c9b30fe7da1681904cef057a2", "shasum": "" }, "require": { @@ -207,7 +207,7 @@ "gutenberg", "woocommerce" ], - "time": "2019-07-10T11:39:03+00:00" + "time": "2019-07-25T14:58:54+00:00" }, { "name": "woocommerce/woocommerce-rest-api", @@ -560,13 +560,13 @@ }, { "name": "Wim Godden", - "homepage": "https://github.com/wimg", - "role": "lead" + "role": "lead", + "homepage": "https://github.com/wimg" }, { "name": "Juliette Reinders Folmer", - "homepage": "https://github.com/jrfnl", - "role": "lead" + "role": "lead", + "homepage": "https://github.com/jrfnl" } ], "description": "A set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility.", @@ -943,8 +943,8 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "role": "lead", + "email": "sebastian@phpunit.de" } ], "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", @@ -1216,8 +1216,8 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "role": "lead", + "email": "sebastian@phpunit.de" } ], "description": "The PHP Unit Testing framework.", From e3dd09d0217e188d47b48e1e2746174ca4e4c30b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Demarle?= Date: Fri, 26 Jul 2019 11:55:30 +0200 Subject: [PATCH 027/361] Fire related actions when deleting all product variations --- .../data-stores/class-wc-product-variable-data-store-cpt.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/includes/data-stores/class-wc-product-variable-data-store-cpt.php b/includes/data-stores/class-wc-product-variable-data-store-cpt.php index 7bfb90f6774..3dcaef927d6 100644 --- a/includes/data-stores/class-wc-product-variable-data-store-cpt.php +++ b/includes/data-stores/class-wc-product-variable-data-store-cpt.php @@ -659,9 +659,12 @@ class WC_Product_Variable_Data_Store_CPT extends WC_Product_Data_Store_CPT imple if ( ! empty( $variation_ids ) ) { foreach ( $variation_ids as $variation_id ) { if ( $force_delete ) { + do_action( 'woocommerce_before_delete_product_variation' , $variation_id ); wp_delete_post( $variation_id, true ); + do_action( 'woocommerce_delete_product_variation' , $variation_id ); } else { wp_trash_post( $variation_id ); + do_action( 'woocommerce_trash_product_variation' , $variation_id ); } } } From 0fa582a25feddcea597a9ae054232d5f50abb398 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Demarle?= Date: Fri, 26 Jul 2019 13:40:13 +0200 Subject: [PATCH 028/361] Coding standards --- .../class-wc-product-variable-data-store-cpt.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/data-stores/class-wc-product-variable-data-store-cpt.php b/includes/data-stores/class-wc-product-variable-data-store-cpt.php index 3dcaef927d6..ee49191d7b3 100644 --- a/includes/data-stores/class-wc-product-variable-data-store-cpt.php +++ b/includes/data-stores/class-wc-product-variable-data-store-cpt.php @@ -659,12 +659,12 @@ class WC_Product_Variable_Data_Store_CPT extends WC_Product_Data_Store_CPT imple if ( ! empty( $variation_ids ) ) { foreach ( $variation_ids as $variation_id ) { if ( $force_delete ) { - do_action( 'woocommerce_before_delete_product_variation' , $variation_id ); + do_action( 'woocommerce_before_delete_product_variation', $variation_id ); wp_delete_post( $variation_id, true ); - do_action( 'woocommerce_delete_product_variation' , $variation_id ); + do_action( 'woocommerce_delete_product_variation', $variation_id ); } else { wp_trash_post( $variation_id ); - do_action( 'woocommerce_trash_product_variation' , $variation_id ); + do_action( 'woocommerce_trash_product_variation', $variation_id ); } } } From 9752c1f8a0a556e05a682e1e675634a30ba3e73e Mon Sep 17 00:00:00 2001 From: Rodrigo Primo Date: Fri, 26 Jul 2019 14:48:05 -0300 Subject: [PATCH 029/361] Update tests documentation Update tests documentation as PHPUnit now should be installed and called using composer instead of globally. This commit also includes some other minor changes to the tests documentation like updating the link of the service used for code coverage reports. --- tests/README.md | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/tests/README.md b/tests/README.md index 835ecf37f82..405dd1be83f 100644 --- a/tests/README.md +++ b/tests/README.md @@ -2,28 +2,25 @@ ## Initial Setup -1) Install [PHPUnit](http://phpunit.de/) by following their [installation guide](https://phpunit.de/getting-started.html). If you've installed it correctly, this should display the version: +From the WooCommerce root directory (if you are using VVV you might need to `vagrant ssh` first), run the following: +1. Install [PHPUnit](http://phpunit.de/) via Composer by running: ``` - $ phpunit --version + $ composer install ``` -2) Install WordPress and the WP Unit Test lib using the `install.sh` script. Change to the plugin root directory and type: - +2. Install WordPress and the WP Unit Test lib using the `install.sh` script: ``` $ tests/bin/install.sh [db-host] ``` -The `` will be set as given. Previously, you would have needed to escape certain characters (forward & backward slashes, and ampersand), but install.sh now escapes them when it needs to internally. You may still need to quote strings with backslashes to prevent them from being processed by the shell or other programs. +You may need to quote strings with backslashes to prevent them from being processed by the shell or other programs. -Sample usages: +Example: $ tests/bin/install.sh woocommerce_tests root root - # The actual password only has a single backslash, but it's escaped - # to prevent the shell and PHP from treating it as a backspace character - $ tests/bin/install.sh woocommerce_tests root 'a\\b/&' - # Previously, the password would have had to be passed as 'a\\\\b\/\&' + # woocommerce_tests is the database name and root is both the MySQL user and its password. **Important**: The `` database will be created if it doesn't exist and all data will be removed during testing. @@ -31,17 +28,17 @@ Sample usages: Simply change to the plugin root directory and type: - $ phpunit + $ vendor/bin/phpunit -The tests will execute and you'll be presented with a summary. Code coverage documentation is automatically generated as HTML in the `tmp/coverage` directory. +The tests will execute and you'll be presented with a summary. You can run specific tests by providing the path and filename to the test class: - $ phpunit tests/unit-tests/api/orders + $ vendor/bin/phpunit tests/unit-tests/importer/product.php A text code coverage summary can be displayed using the `--coverage-text` option: - $ phpunit --coverage-text + $ vendor/bin/phpunit --coverage-text ## Writing Tests @@ -51,7 +48,7 @@ A text code coverage summary can be displayed using the `--coverage-text` option * Use the test coverage HTML report (under `tmp/coverage/index.html`) to examine which lines your tests are covering and aim for 100% coverage * For code that cannot be tested (e.g. they require a certain PHP version), you can exclude them from coverage using a comment: `// @codeCoverageIgnoreStart` and `// @codeCoverageIgnoreEnd`. For example, see [`wc_round_tax_total()`](https://github.com/woocommerce/woocommerce/blob/35f83867736713955fa2c4f463a024578bb88795/includes/wc-formatting-functions.php#L208-L219) * In addition to covering each line of a method/function, make sure to test common input and edge cases. -* Prefer `assertSame()` where possible as it tests both type & equality +* Prefer `assertSame()` where possible as it tests both type and value * Remember that only methods prefixed with `test` will be run so use helper methods liberally to keep test methods small and reduce code duplication. If there is a common helper method used in multiple test files, consider adding it to the `WC_Unit_Test_Case` class so it can be shared by all test cases * Filters persist between test cases so be sure to remove them in your test method or in the `tearDown()` method. * Use data providers where possible. Be sure that their name is like `data_provider_function_to_test` (i.e. the data provider for `test_is_postcode` would be `data_provider_test_is_postcode`). Read more about data providers [here](https://phpunit.de/manual/current/en/writing-tests-for-phpunit.html#writing-tests-for-phpunit.data-providers). @@ -62,4 +59,4 @@ Tests are automatically run with [Travis-CI](https://travis-ci.org/woocommerce/w ## Code Coverage -Code coverage is available on [Scrutinizer](https://scrutinizer-ci.com/g/woocommerce/woocommerce/) and [Code Climate](https://codeclimate.com/github/woocommerce/woocommerce) which receives updated data after each Travis build. +Code coverage is available on [Scrutinizer](https://scrutinizer-ci.com/g/woocommerce/woocommerce/) and [Codecov](https://codecov.io/gh/woocommerce/woocommerce/) which receives updated data after each Travis build. From b18135fd3c1c0b1ead5ca2f5649d6fd5ceabd176 Mon Sep 17 00:00:00 2001 From: Rodrigo Primo Date: Fri, 26 Jul 2019 14:59:49 -0300 Subject: [PATCH 030/361] Consolidate info about support on the README.md file This commit removes duplicated information about support from CONTRIBUTING.md and consolidates it in README.md. --- .github/CONTRIBUTING.md | 22 ---------------------- README.md | 5 ++++- 2 files changed, 4 insertions(+), 23 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 85c87d16c7c..0f1fc2720fe 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -20,28 +20,6 @@ Feature request issues will remain closed until we see sufficient interest via c You can see a [list of current feature requests which require votes here](https://github.com/woocommerce/woocommerce/issues?q=label%3A%22votes+needed%22+label%3Aenhancement+sort%3Areactions-%2B1-desc+is%3Aclosed). -## Technical Support / Questions ❓ - -We don't offer technical support on GitHub so we recommend using the following: - -**Reading our documentation** -Usage docs can be found here: https://docs.woocommerce.com/ - -If you have a problem, you may want to start with the self help guide here: https://docs.woocommerce.com/document/woocommerce-self-service-guide/ - -**Technical support for premium extensions or if you're a WooCommerce.com customer** - from a human being - submit a ticket via the helpdesk -https://woocommerce.com/contact-us/ - -**General usage and development questions** -- WooCommerce Slack Community: https://woocommerce.com/community-slack/ -- WordPress.org Forums: https://wordpress.org/support/plugin/woocommerce -- The WooCommerce Help and Share Facebook group - -**Customizations** -- [WooExperts](https://woocommerce.com/experts/) -- [Codeable](https://codeable.io/) - ## Build process 🛠 The source code found on GitHub does not contain compiled CSS or Javascript, and is missing some functionality such as Gutenberg Blocks and the REST API, until the build process is ran. diff --git a/README.md b/README.md index 099eb8d3e8c..6779bbeabe4 100644 --- a/README.md +++ b/README.md @@ -25,8 +25,11 @@ To disclose a security issue to our team, [please submit a report via HackerOne ## Support This repository is not suitable for support. Please don't use our issue tracker for support requests, but for core WooCommerce issues only. Support can take place through the appropriate channels: -* The [WooCommerce premium support portal](https://woocommerce.com/my-account/create-a-ticket/) for customers who have purchased themes or extensions. +* If you have a problem, you may want to start with the [self help guide](https://docs.woocommerce.com/document/woocommerce-self-service-guide/). +* The [WooCommerce.com premium support portal](https://woocommerce.com/contact-us/ ) for customers who have purchased themes or extensions. * [Our community forum on wp.org](https://wordpress.org/support/plugin/woocommerce) which is available for all WooCommerce users. +* The WooCommerce Help and Share Facebook group. +* For customizations, you may want to check our list of [WooExperts](https://woocommerce.com/experts/) or [Codeable](https://codeable.io/). Support requests in issues on this repository will be closed on sight. From 8aa62dc8585cb6d06909ff501626976236235e85 Mon Sep 17 00:00:00 2001 From: Rodrigo Primo Date: Fri, 26 Jul 2019 15:08:29 -0300 Subject: [PATCH 031/361] Add a link to the wiki in the README.md file --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 6779bbeabe4..ae91337621f 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ If you are not a developer, please use the [WooCommerce plugin page](https://wor ## Documentation * [WooCommerce Documentation](https://docs.woocommerce.com/documentation/plugins/woocommerce/) +* [WooCommerce Developer Documentation](https://github.com/woocommerce/woocommerce/wiki) * [WooCommerce Code Reference](https://docs.woocommerce.com/wc-apidocs/) * [WooCommerce REST API Docs](https://woocommerce.github.io/woocommerce-rest-api-docs/) From b0fef8e8ef60be70175cb1379dc8db589d0fdad8 Mon Sep 17 00:00:00 2001 From: Rodrigo Primo Date: Fri, 26 Jul 2019 15:19:25 -0300 Subject: [PATCH 032/361] Move Translating WooCommerce section to its own page https://github.com/woocommerce/woocommerce/wiki/Translating-WooCommerce --- .github/CONTRIBUTING.md | 40 ---------------------------------------- 1 file changed, 40 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 0f1fc2720fe..5a3982393eb 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -48,43 +48,3 @@ Please avoid modifying the change-log directly or updating the .pot files. These If you are contributing code to the REST API or editor blocks, these are developed in external packages. - [WooCommerce REST API package](https://github.com/woocommerce/woocommerce-rest-api) - [Blocks](https://github.com/woocommerce/woocommerce-gutenberg-products-block) - -## Translating WooCommerce 💬 - -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/). - -If WooCommerce is already 100% translated for your language, join the team anyway! We regularly update our language files and there will definitely be need of your help soon. - -### Glossary & Style Guide - -Please refer to this page on the [Translator Handbook](https://make.wordpress.org/polyglots/handbook/translating/glossary-style-guide/) for information about the glossary and the style guide. - -We maintain the WooCommerce glossary [on this shared Google Sheet](https://docs.google.com/spreadsheets/d/1Pobl2nNWieaSpZND9-Bwa4G8pnMU7QYceKsXuWCwSxQ/edit?usp=sharing). You can use it as a template for creating your own glossary. -Please download the file by going to **File > Download as > Comma-separated values (.csv, current sheet)** and save it on your computer/Mac. Open it with your favourite CSV editor (or re-upload it on your own Google Drive) and edit it. - -Make sure to edit the second column’s header by using your own language’s code (eg. for Italian you would use `it`, for Portuguese (Brazil) you would use `pt-BR`). - -Write the translated entry in this column and translate the entry description as well. -Don’t change other columns headers and value, but feel free to add new entries. - -When your CSV is ready, import it on GlotPress. - -_**Warning**: Importing a CSV does not replace existing items, they will be created again. We suggest to import them only when first creating the glossary._ - -Each translation editor will take care of updating the glossary on GlotPress by editing/adding items when needed. - -_**Note**: Only editors can create/import and edit glossaries and glossary items on GlotPress. Anyone can suggest new items to add to the glossary or translate them._ - -**Style Guides Available** - -We don’t have a Style Guide template available, so feel free to create your own. Here are the style guides available at the moment: - -* [Italian](https://docs.google.com/document/d/1rspopHOiTL-5-PjyG5eJxjkYk6JkzqVbyS24OdA052o/edit?usp=sharing) - -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 Video Tutorials - -Another valuable way to help is by translating our growing library of WooCommerce video tutorials. Check out the [Translating Our Videos](https://docs.woocommerce.com/document/translating-our-videos/) doc and join in! - -By translating video tutorials you'll be helping non-English speaking users and people affected by disabilities to get to grips with using WooCommerce for the first time, and to go on and create their businesses and make a living! That's something to be proud of and if you choose to dive into this area, we salute you. From 896f1391f0ed7144f520990b7190dd93300ed6ce Mon Sep 17 00:00:00 2001 From: Rodrigo Primo Date: Fri, 26 Jul 2019 15:20:10 -0300 Subject: [PATCH 033/361] Remove section about the build process This is already covered in the document about how to set up a development enviroment. --- .github/CONTRIBUTING.md | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 5a3982393eb..d903080b609 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -20,20 +20,6 @@ Feature request issues will remain closed until we see sufficient interest via c You can see a [list of current feature requests which require votes here](https://github.com/woocommerce/woocommerce/issues?q=label%3A%22votes+needed%22+label%3Aenhancement+sort%3Areactions-%2B1-desc+is%3Aclosed). -## Build process 🛠 - -The source code found on GitHub does not contain compiled CSS or Javascript, and is missing some functionality such as Gutenberg Blocks and the REST API, until the build process is ran. - -To run the build process, in a terminal go to your WooCommerce installation and run: - -```bash -npm install -composer install -npm run build -``` - -To get your development environment running we recommend [reading here](https://github.com/woocommerce/woocommerce/wiki/How-to-set-up-WooCommerce-development-environment). - ## Coding Guidelines and Development 🛠 - **Ensure you stick to the [WordPress Coding Standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/php/)** From e0541fc2d1095f31438a80849e7eaf50dcf0a808 Mon Sep 17 00:00:00 2001 From: Rodrigo Primo Date: Fri, 26 Jul 2019 16:05:52 -0300 Subject: [PATCH 034/361] Reorganize CONTRIBUTING.md --- .github/CONTRIBUTING.md | 63 +++++++++++++++++++++++++---------------- 1 file changed, 39 insertions(+), 24 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index d903080b609..ef61609c2b5 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -1,16 +1,46 @@ # Contributing to WooCommerce ✨ -There are many ways to contribute to the WooCommerce project! - -- Translating strings into your language. -- Answering questions on GitHub and within the various WooCommerce communities. -- Submitting fixes, improvements, and enhancements. - WooCommerce currently powers 30% of all online stores across the internet, and your help making it even more awesome will be greatly appreciated :) -If you think something can be improved and you wish to contribute code, -[fork](https://help.github.com/articles/fork-a-repo/) WooCommerce, commit your changes, -and [send a pull request](https://help.github.com/articles/using-pull-requests/). We'll be happy to review your changes! +There are many ways to contribute to the project! + +- [Translating strings into your language](https://github.com/woocommerce/woocommerce/wiki/Translating-WooCommerce). +- Answering questions on the various WooCommerce communities like the [WP.org support forums](https://wordpress.org/support/plugin/woocommerce/). +- Testing open [issues](https://github.com/woocommerce/woocommerce/issues) or [pull requests](https://github.com/woocommerce/woocommerce/pulls) and sharing your findings in a comment. +- Testing WooCommerce beta versions and release candidates. Those are announced in the [WooCommerce development blog](https://woocommerce.wordpress.com/). +- Submitting fixes, improvements, and enhancements. +- To disclose a security issue to our team, [please submit a report via HackerOne](https://hackerone.com/automattic/). + +If you wish to contribute code, before [forking](https://help.github.com/articles/fork-a-repo/) WooCommerce, commiting your changes, +and [sendind a pull request](https://help.github.com/articles/using-pull-requests/), please see the information in the sections below. + +WooCommerce is licensed under the GPLv2+, and all contributions to the project will be released under the same license. You maintain copyright over any contribution you make, and by submitting a pull request, you are agreeing to release that contribution under the GPLv2+ license. + +If you have questions about the process to contribute code or want to discuss details of your contribution, you can contact WooCommerce core developers on the #core channel in the [WooCommerce community Slack](https://woocommerce.com/community-slack/). + +## Getting started + +- [How to set up WooCommerce development environment](How-to-set-up-WooCommerce-development-environment) +- [Minification of SCSS and JS](Minification-of-SCSS-and-JS) +- [String localisation guidelines](String-localisation-guidelines) +- [Running unit tests](https://github.com/woocommerce/woocommerce/blob/master/tests/README.md) +- [Running e2e tests](End-to-end-Testing) + +## Coding Guidelines and Development 🛠 + +- Ensure you stick to the [WordPress Coding Standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/php/) +- Run our build process described in the document on [how to set up WooCommerce development environment](How-to-set-up-WooCommerce-development-environment), it will install our pre-commit hook, code sniffs, dependencies, and more. +- Whenever possible please fix pre-existing code standards errors in the files that you change. It is ok to skip that for larger files or complex fixes. +- Ensure you use LF line endings in your code editor. Use [EditorConfig](http://editorconfig.org/) if your editor supports it so that indentation, line endings and other settings are auto configured. +- When committing, reference your issue number (#1234) and include a note about the fix. +- Ensure that your code supports the minimum supported versions of PHP and WordPress; this is shown at the top of the `readme.txt` file. +- Push the changes to your fork and submit a pull request on the master branch of the WooCommerce repository. +- Make sure to write good and detailed commit messages (see [this post](https://chris.beams.io/posts/git-commit/) for more on this) and follow all the applicable sections of the pull request template. +- Please avoid modifying the changelog directly or updating the .pot files. These will be updated by the WooCommerce team. + +If you are contributing code to the REST API or editor blocks, these are developed in external packages. +- [WooCommerce REST API package](https://github.com/woocommerce/woocommerce-rest-api) +- [Blocks](https://github.com/woocommerce/woocommerce-gutenberg-products-block) ## Feature Requests 🚀 @@ -19,18 +49,3 @@ Feature requests can be [submitted to our issue tracker](https://github.com/wooc Feature request issues will remain closed until we see sufficient interest via comments and [👍 reactions](https://help.github.com/articles/about-discussions-in-issues-and-pull-requests/) from the community. You can see a [list of current feature requests which require votes here](https://github.com/woocommerce/woocommerce/issues?q=label%3A%22votes+needed%22+label%3Aenhancement+sort%3Areactions-%2B1-desc+is%3Aclosed). - -## Coding Guidelines and Development 🛠 - -- **Ensure you stick to the [WordPress Coding Standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/php/)** -- Run our build process described in the section above, it will install our pre-commit hook, code sniffs, dependencies, and more. -- Ensure you use LF line endings in your code editor. Use [EditorConfig](http://editorconfig.org/) if your editor supports it so that indentation, line endings and other settings are auto configured. -- When committing, reference your issue number (#1234) and include a note about the fix. -- Ensure that your code supports the minimum supported versions of PHP and WordPress; this is shown at the top of the `readme.txt` file. -- Push the changes to your fork and submit a pull request on the master branch of the WooCommerce repository. - -Please avoid modifying the change-log directly or updating the .pot files. These will be updated by the WooCommerce team. - -If you are contributing code to the REST API or editor blocks, these are developed in external packages. -- [WooCommerce REST API package](https://github.com/woocommerce/woocommerce-rest-api) -- [Blocks](https://github.com/woocommerce/woocommerce-gutenberg-products-block) From ce4f0edc3a0a143204b452e43621a651ff8f4e32 Mon Sep 17 00:00:00 2001 From: Miguel Pinto Date: Mon, 29 Jul 2019 09:25:30 +0100 Subject: [PATCH 035/361] Avoid duplicated process for IPN and PDT payment Currently, Woocommerce is processing twice the payment when IPN and PDT notifications are enable. This mean that stock is reduced twice. --- .../paypal/includes/class-wc-gateway-paypal-response.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/includes/gateways/paypal/includes/class-wc-gateway-paypal-response.php b/includes/gateways/paypal/includes/class-wc-gateway-paypal-response.php index 07bc46a219f..c360aac75d4 100644 --- a/includes/gateways/paypal/includes/class-wc-gateway-paypal-response.php +++ b/includes/gateways/paypal/includes/class-wc-gateway-paypal-response.php @@ -63,9 +63,12 @@ abstract class WC_Gateway_Paypal_Response { * @param string $note Payment note. */ protected function payment_complete( $order, $txn_id = '', $note = '' ) { - $order->add_order_note( $note ); - $order->payment_complete( $txn_id ); - WC()->cart->empty_cart(); + if( ! get_post_meta($order->get_id(),"_paypal_payment_completed",true) ) { + $order->add_order_note( $note ); + $order->payment_complete( $txn_id ); + WC()->cart->empty_cart(); + update_post_meta($order->get_id(),"_paypal_payment_completed","yes"); + } } /** From 978f0ef88db32380ab1e0fe6df5ede3ccaa810d9 Mon Sep 17 00:00:00 2001 From: Gerhard Date: Mon, 29 Jul 2019 10:56:13 +0200 Subject: [PATCH 036/361] Add backward compatible functionality to the new table if maybe_remove_tax_class_rates happens to get called. --- includes/class-wc-tax.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/includes/class-wc-tax.php b/includes/class-wc-tax.php index 65a6909372c..d93b2b8fdde 100644 --- a/includes/class-wc-tax.php +++ b/includes/class-wc-tax.php @@ -44,7 +44,18 @@ class WC_Tax { * @param string $value New rates value. */ public static function maybe_remove_tax_class_rates( $old_value, $value ) { - wc_deprecated_function( 'WC_Tax::maybe_remove_tax_class_rates', '3.7' ); + wc_deprecated_function( 'WC_Tax::maybe_remove_tax_class_rates', '3.7', 'WC_Tax::delete_tax_class_by' ); + + $tax_classes = array_filter( array_map( 'trim', explode( "\n", $value ) ) ); + $existing_tax_classes = self::get_tax_classes(); + $removed = array_diff( $existing_tax_classes, $tax_classes ); + $added = array_diff( $tax_classes, $existing_tax_classes ); + foreach ( $removed as $name ) { + self::delete_tax_class_by( 'name', $name ); + } + foreach ( $added as $name ) { + self::create_tax_class( $name ); + } } /** From 41d0702a3c17b523b1402e3e320f6253f8517099 Mon Sep 17 00:00:00 2001 From: Gerhard Date: Mon, 29 Jul 2019 11:20:58 +0200 Subject: [PATCH 037/361] Exclude new packages and vendor folders from unit tests --- phpunit.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/phpunit.xml b/phpunit.xml index 598e7e97b4e..d8b796394e8 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -36,6 +36,9 @@ ./includes/updates ./includes/vendor ./includes/widgets + ./packages + ./src + ./vendor ./includes/wc-deprecated-functions.php ./includes/wc-template-hooks.php ./includes/wc-widget-functions.php From 4fa1e7d4312ea8f9c7b3da6342e3e1c03f6cd09f Mon Sep 17 00:00:00 2001 From: Gerhard Date: Mon, 29 Jul 2019 11:53:15 +0200 Subject: [PATCH 038/361] Only remove --- includes/class-wc-tax.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/includes/class-wc-tax.php b/includes/class-wc-tax.php index d93b2b8fdde..609d0019c5c 100644 --- a/includes/class-wc-tax.php +++ b/includes/class-wc-tax.php @@ -49,13 +49,9 @@ class WC_Tax { $tax_classes = array_filter( array_map( 'trim', explode( "\n", $value ) ) ); $existing_tax_classes = self::get_tax_classes(); $removed = array_diff( $existing_tax_classes, $tax_classes ); - $added = array_diff( $tax_classes, $existing_tax_classes ); foreach ( $removed as $name ) { self::delete_tax_class_by( 'name', $name ); } - foreach ( $added as $name ) { - self::create_tax_class( $name ); - } } /** From fa9dfa64e20ff60f3e24bb40b63f036da9d2bed3 Mon Sep 17 00:00:00 2001 From: Gerhard Date: Mon, 29 Jul 2019 13:23:52 +0200 Subject: [PATCH 039/361] Bump version to 3.7.0-rc.1 and update changelog with changes since beta. --- readme.txt | 3 ++- woocommerce.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/readme.txt b/readme.txt index c89ab4bb54b..95424127fcd 100644 --- a/readme.txt +++ b/readme.txt @@ -247,7 +247,8 @@ INTERESTED IN DEVELOPMENT? * Dev - Added `$order` and `$product` as parameters to the `woocommerce_ajax_order_item` filter in `WC_Ajax::add_order_item()`. #24108 * Dev - Add new `woocommerce_product_import_image_separator` filter in `WC_Product_CSV_Importer::parse_images_field()` for adjusting the product images seperator. #24120 * Dev - Add new `woocommerce_widget_shopping_cart_subtotal()` template function that hooks into the `woocommerce_widget_shopping_cart_total` action to output the mini cart subtotal. #24145 -* Dev - Removed the `woocommerce_before_cart_item_quantity_zero` action from `WC_Cart::restore_cart_item()` in favor of existing `woocommerce_cart_item_removed` action. #23112 +* Dev - Deprecate the `woocommerce_before_cart_item_quantity_zero` action from `WC_Cart::restore_cart_item()` in favor of existing `woocommerce_cart_item_removed` action. #23112 +* Dev - Deprecate WC_Tax::maybe_remove_tax_class_rates which hooked into the WP Options update hook for taxes in favor of new function WC_Tax::delete_tax_class_by which works on the new tax classes table. #24213 * Fix - Use version_compare for determining the maximum WooCommerce database version number. #23092 * Fix - Missing space and closing `` tag in WooCommerce.com disconnect message. #24073 * Fix - CSV Importer - Skip rows during update if a SKU column exists, but the value is empty. #23262 diff --git a/woocommerce.php b/woocommerce.php index ca3259bcd77..e6d11ed569a 100644 --- a/woocommerce.php +++ b/woocommerce.php @@ -3,7 +3,7 @@ * Plugin Name: WooCommerce * Plugin URI: https://woocommerce.com/ * Description: An eCommerce toolkit that helps you sell anything. Beautifully. - * Version: 3.7.0-beta.1 + * Version: 3.7.0-rc.1 * Author: Automattic * Author URI: https://woocommerce.com * Text Domain: woocommerce From 7bf9353d21f72c54553d01ac6bdce0abd0ac4248 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 29 Jul 2019 16:42:16 +0000 Subject: [PATCH 040/361] Update dependency woocommerce/woocommerce-blocks to v2.3.0-beta.3 --- composer.json | 2 +- composer.lock | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index 98d4367bb47..204370cea6e 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ "automattic/jetpack-autoloader": "1.2.0", "php": ">=5.6|>=7.0", "composer/installers": "1.6.0", - "woocommerce/woocommerce-blocks": "2.3.0-beta.2", + "woocommerce/woocommerce-blocks": "2.3.0-beta.3", "woocommerce/woocommerce-rest-api": "1.0.3" }, "require-dev": { diff --git a/composer.lock b/composer.lock index 50585b6f748..310d6e94d4c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "8b88f3c424707ce9ffe80b4fe6e600a5", + "content-hash": "9d1e096234a97eef4dba1acc58ed36b2", "packages": [ { "name": "automattic/jetpack-autoloader", @@ -164,16 +164,16 @@ }, { "name": "woocommerce/woocommerce-blocks", - "version": "v2.3.0-beta.2", + "version": "v2.3.0-beta.3", "source": { "type": "git", "url": "https://github.com/woocommerce/woocommerce-gutenberg-products-block.git", - "reference": "6894c51726556d3c9b30fe7da1681904cef057a2" + "reference": "b23197a147a2eddbc36ba58742e82991dcf2866b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/woocommerce/woocommerce-gutenberg-products-block/zipball/6894c51726556d3c9b30fe7da1681904cef057a2", - "reference": "6894c51726556d3c9b30fe7da1681904cef057a2", + "url": "https://api.github.com/repos/woocommerce/woocommerce-gutenberg-products-block/zipball/b23197a147a2eddbc36ba58742e82991dcf2866b", + "reference": "b23197a147a2eddbc36ba58742e82991dcf2866b", "shasum": "" }, "require": { @@ -207,7 +207,7 @@ "gutenberg", "woocommerce" ], - "time": "2019-07-25T14:58:54+00:00" + "time": "2019-07-29T16:15:48+00:00" }, { "name": "woocommerce/woocommerce-rest-api", From 2b7755693d46bdb18a482cf6fa42a04916abdd5e Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 29 Jul 2019 17:19:08 +0000 Subject: [PATCH 041/361] Update dependency husky to v3.0.2 --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index a130f73d438..85bdf51abc8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5956,9 +5956,9 @@ } }, "husky": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/husky/-/husky-3.0.1.tgz", - "integrity": "sha512-PXBv+iGKw23GHUlgELRlVX9932feFL407/wHFwtsGeArp0dDM4u+/QusSQwPKxmNgjpSL+ustbOdQ2jetgAZbA==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/husky/-/husky-3.0.2.tgz", + "integrity": "sha512-WXCtaME2x0o4PJlKY4ap8BzLA+D0zlvefqAvLCPriOOu+x0dpO5uc5tlB7CY6/0SE2EESmoZsj4jW5D09KrJoA==", "dev": true, "requires": { "chalk": "^2.4.2", diff --git a/package.json b/package.json index 98d026aa4e4..bc605032b41 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "grunt-shell": "3.0.1", "grunt-stylelint": "0.11.0", "grunt-wp-i18n": "1.0.3", - "husky": "3.0.1", + "husky": "3.0.2", "istanbul": "1.0.0-alpha.2", "lint-staged": "9.2.1", "mocha": "6.2.0", From d7b54ccb352a1208b28b4d284f5ea8cad2616da3 Mon Sep 17 00:00:00 2001 From: Miguel Pinto Date: Tue, 30 Jul 2019 20:56:43 +0100 Subject: [PATCH 042/361] Update class-wc-gateway-paypal-response.php --- .../paypal/includes/class-wc-gateway-paypal-response.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/gateways/paypal/includes/class-wc-gateway-paypal-response.php b/includes/gateways/paypal/includes/class-wc-gateway-paypal-response.php index c360aac75d4..36ff60e98e0 100644 --- a/includes/gateways/paypal/includes/class-wc-gateway-paypal-response.php +++ b/includes/gateways/paypal/includes/class-wc-gateway-paypal-response.php @@ -63,11 +63,11 @@ abstract class WC_Gateway_Paypal_Response { * @param string $note Payment note. */ protected function payment_complete( $order, $txn_id = '', $note = '' ) { - if( ! get_post_meta($order->get_id(),"_paypal_payment_completed",true) ) { + if( ! $order->get_meta('_paypal_payment_completed',true) ) { $order->add_order_note( $note ); $order->payment_complete( $txn_id ); WC()->cart->empty_cart(); - update_post_meta($order->get_id(),"_paypal_payment_completed","yes"); + $order->update_meta_data('_paypal_payment_completed','yes'); } } From de978dad2868248896cdc354f9dc133e161391ec Mon Sep 17 00:00:00 2001 From: Miguel Pinto Date: Tue, 30 Jul 2019 21:31:55 +0100 Subject: [PATCH 043/361] Update class-wc-gateway-paypal-response.php --- .../paypal/includes/class-wc-gateway-paypal-response.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/gateways/paypal/includes/class-wc-gateway-paypal-response.php b/includes/gateways/paypal/includes/class-wc-gateway-paypal-response.php index 36ff60e98e0..9ac35aed139 100644 --- a/includes/gateways/paypal/includes/class-wc-gateway-paypal-response.php +++ b/includes/gateways/paypal/includes/class-wc-gateway-paypal-response.php @@ -63,11 +63,11 @@ abstract class WC_Gateway_Paypal_Response { * @param string $note Payment note. */ protected function payment_complete( $order, $txn_id = '', $note = '' ) { - if( ! $order->get_meta('_paypal_payment_completed',true) ) { + if( ! $order->get_meta( '_paypal_payment_completed', true ) ) { $order->add_order_note( $note ); $order->payment_complete( $txn_id ); WC()->cart->empty_cart(); - $order->update_meta_data('_paypal_payment_completed','yes'); + $order->update_meta_data( '_paypal_payment_completed', 'yes' ); } } From 289f3c62fb794ca67a940774f0d07cf4b0fe9092 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Wed, 31 Jul 2019 00:11:56 +0000 Subject: [PATCH 044/361] Update dependency chromedriver to v76 --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 85bdf51abc8..13bd4b69460 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2313,9 +2313,9 @@ } }, "chromedriver": { - "version": "75.1.0", - "resolved": "https://registry.npmjs.org/chromedriver/-/chromedriver-75.1.0.tgz", - "integrity": "sha512-N2P0fg6FS4c+tTG0R7cCOD5qiVo+E6uAz6xVjmbZesYv1xs1iGdcCUo0IqOY+ppD/4OOObG+XWV1CFWXT6UIgA==", + "version": "76.0.0", + "resolved": "https://registry.npmjs.org/chromedriver/-/chromedriver-76.0.0.tgz", + "integrity": "sha512-jGyqs0N+lMo9iaNQxGKNPiLJWb2L9s2rwbRr1jJeQ37n6JQ1+5YMGviv/Fx5Z08vBWYbAvrKEzFsuYf8ppl+lw==", "dev": true, "requires": { "del": "^4.1.1", diff --git a/package.json b/package.json index bc605032b41..2caf2c0672a 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "babel-preset-stage-2": "6.24.1", "chai": "4.2.0", "chai-as-promised": "7.1.1", - "chromedriver": "75.1.0", + "chromedriver": "76.0.0", "config": "3.2.2", "cross-env": "5.2.0", "eslint": "6.1.0", From 77f4a3e25b6f6c0b56e5de4e5bed971583f2f2ad Mon Sep 17 00:00:00 2001 From: Miguel Pinto Date: Wed, 31 Jul 2019 09:48:41 +0100 Subject: [PATCH 045/361] Update class-wc-gateway-paypal-response.php --- .../paypal/includes/class-wc-gateway-paypal-response.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/gateways/paypal/includes/class-wc-gateway-paypal-response.php b/includes/gateways/paypal/includes/class-wc-gateway-paypal-response.php index 9ac35aed139..18048195128 100644 --- a/includes/gateways/paypal/includes/class-wc-gateway-paypal-response.php +++ b/includes/gateways/paypal/includes/class-wc-gateway-paypal-response.php @@ -63,7 +63,7 @@ abstract class WC_Gateway_Paypal_Response { * @param string $note Payment note. */ protected function payment_complete( $order, $txn_id = '', $note = '' ) { - if( ! $order->get_meta( '_paypal_payment_completed', true ) ) { + if ( ! $order->get_meta( '_paypal_payment_completed', true ) ) { $order->add_order_note( $note ); $order->payment_complete( $txn_id ); WC()->cart->empty_cart(); From 387ee9c20b23e686829a682a35a6e0f7304dbbff Mon Sep 17 00:00:00 2001 From: Rodrigo Primo Date: Wed, 31 Jul 2019 09:05:12 -0300 Subject: [PATCH 046/361] Fix GPL version --- .github/CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index ef61609c2b5..0833eae2a40 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -14,7 +14,7 @@ There are many ways to contribute to the project! If you wish to contribute code, before [forking](https://help.github.com/articles/fork-a-repo/) WooCommerce, commiting your changes, and [sendind a pull request](https://help.github.com/articles/using-pull-requests/), please see the information in the sections below. -WooCommerce is licensed under the GPLv2+, and all contributions to the project will be released under the same license. You maintain copyright over any contribution you make, and by submitting a pull request, you are agreeing to release that contribution under the GPLv2+ license. +WooCommerce is licensed under the GPLv3+, and all contributions to the project will be released under the same license. You maintain copyright over any contribution you make, and by submitting a pull request, you are agreeing to release that contribution under the GPLv3+ license. If you have questions about the process to contribute code or want to discuss details of your contribution, you can contact WooCommerce core developers on the #core channel in the [WooCommerce community Slack](https://woocommerce.com/community-slack/). From cef6d4744d0468b264dd98e9c3defbd9a98d13b9 Mon Sep 17 00:00:00 2001 From: Rodrigo Primo Date: Wed, 31 Jul 2019 09:07:51 -0300 Subject: [PATCH 047/361] Improve paragraph about the process to contribute code to WC core --- .github/CONTRIBUTING.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 0833eae2a40..c5fc015cd9d 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -11,8 +11,7 @@ There are many ways to contribute to the project! - Submitting fixes, improvements, and enhancements. - To disclose a security issue to our team, [please submit a report via HackerOne](https://hackerone.com/automattic/). -If you wish to contribute code, before [forking](https://help.github.com/articles/fork-a-repo/) WooCommerce, commiting your changes, -and [sendind a pull request](https://help.github.com/articles/using-pull-requests/), please see the information in the sections below. +If you wish to contribute code, please read the information in the sections below. Then [fork](https://help.github.com/articles/fork-a-repo/) WooCommerce, commit your changes, and [submit a pull request](https://help.github.com/articles/using-pull-requests/) 🎉 WooCommerce is licensed under the GPLv3+, and all contributions to the project will be released under the same license. You maintain copyright over any contribution you make, and by submitting a pull request, you are agreeing to release that contribution under the GPLv3+ license. From b8d50dc5b7732a93350c5add6c5734d64deb39b7 Mon Sep 17 00:00:00 2001 From: Rodrigo Primo Date: Wed, 31 Jul 2019 09:19:52 -0300 Subject: [PATCH 048/361] Add link to the WooCommerce Git Flow page in the "Getting started" section --- .github/CONTRIBUTING.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index c5fc015cd9d..d5ab2c5a1ca 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -20,6 +20,7 @@ If you have questions about the process to contribute code or want to discuss de ## Getting started - [How to set up WooCommerce development environment](How-to-set-up-WooCommerce-development-environment) +- [Git Flow](WooCommerce-Git-Flow) - [Minification of SCSS and JS](Minification-of-SCSS-and-JS) - [String localisation guidelines](String-localisation-guidelines) - [Running unit tests](https://github.com/woocommerce/woocommerce/blob/master/tests/README.md) From ab35e2968b8efa7688e55fd513fc383eea0af3f8 Mon Sep 17 00:00:00 2001 From: Rodrigo Primo Date: Wed, 31 Jul 2019 09:26:16 -0300 Subject: [PATCH 049/361] Fix links that point to the internal wiki --- .github/CONTRIBUTING.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index d5ab2c5a1ca..1d901a1145e 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -19,17 +19,17 @@ If you have questions about the process to contribute code or want to discuss de ## Getting started -- [How to set up WooCommerce development environment](How-to-set-up-WooCommerce-development-environment) -- [Git Flow](WooCommerce-Git-Flow) -- [Minification of SCSS and JS](Minification-of-SCSS-and-JS) -- [String localisation guidelines](String-localisation-guidelines) +- [How to set up WooCommerce development environment](https://github.com/woocommerce/woocommerce/wiki/How-to-set-up-WooCommerce-development-environment) +- [Git Flow](https://github.com/woocommerce/woocommerce/wiki/WooCommerce-Git-Flow) +- [Minification of SCSS and JS](https://github.com/woocommerce/woocommerce/wiki/Minification-of-SCSS-and-JS) +- [String localisation guidelines](https://github.com/woocommerce/woocommerce/wiki/String-localisation-guidelines) - [Running unit tests](https://github.com/woocommerce/woocommerce/blob/master/tests/README.md) -- [Running e2e tests](End-to-end-Testing) +- [Running e2e tests](https://github.com/woocommerce/woocommerce/wiki/End-to-end-Testing) ## Coding Guidelines and Development 🛠 - Ensure you stick to the [WordPress Coding Standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/php/) -- Run our build process described in the document on [how to set up WooCommerce development environment](How-to-set-up-WooCommerce-development-environment), it will install our pre-commit hook, code sniffs, dependencies, and more. +- Run our build process described in the document on [how to set up WooCommerce development environment](https://github.com/woocommerce/woocommerce/wiki/How-to-set-up-WooCommerce-development-environment), it will install our pre-commit hook, code sniffs, dependencies, and more. - Whenever possible please fix pre-existing code standards errors in the files that you change. It is ok to skip that for larger files or complex fixes. - Ensure you use LF line endings in your code editor. Use [EditorConfig](http://editorconfig.org/) if your editor supports it so that indentation, line endings and other settings are auto configured. - When committing, reference your issue number (#1234) and include a note about the fix. From 66a365edcd3e19241f480811ba519718a441be9d Mon Sep 17 00:00:00 2001 From: Rodrigo Primo Date: Wed, 31 Jul 2019 09:35:51 -0300 Subject: [PATCH 050/361] Add sentence about the `help wanted` label --- .github/CONTRIBUTING.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 1d901a1145e..02e936ccfc2 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -13,6 +13,8 @@ There are many ways to contribute to the project! If you wish to contribute code, please read the information in the sections below. Then [fork](https://help.github.com/articles/fork-a-repo/) WooCommerce, commit your changes, and [submit a pull request](https://help.github.com/articles/using-pull-requests/) 🎉 +We use the `help wanted` label to mark issues that are suitable for new contributors. You can find all the issues with this label [here](https://github.com/woocommerce/woocommerce/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22). + WooCommerce is licensed under the GPLv3+, and all contributions to the project will be released under the same license. You maintain copyright over any contribution you make, and by submitting a pull request, you are agreeing to release that contribution under the GPLv3+ license. If you have questions about the process to contribute code or want to discuss details of your contribution, you can contact WooCommerce core developers on the #core channel in the [WooCommerce community Slack](https://woocommerce.com/community-slack/). From 9fa62f8c3b222d9b35181dfcaf583d0b17622f48 Mon Sep 17 00:00:00 2001 From: Sandro Dzneladze Date: Wed, 31 Jul 2019 19:57:38 +0400 Subject: [PATCH 051/361] Bring back class for backwards compatibility --- templates/myaccount/form-login.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/myaccount/form-login.php b/templates/myaccount/form-login.php index e99c551eb94..42ec5c08870 100644 --- a/templates/myaccount/form-login.php +++ b/templates/myaccount/form-login.php @@ -104,7 +104,7 @@ do_action( 'woocommerce_before_customer_login_form' ); ?>

- +

From 83d789ffba8080ea08191861654152b8b4bf9023 Mon Sep 17 00:00:00 2001 From: David Stone Date: Wed, 31 Jul 2019 12:58:37 -0600 Subject: [PATCH 052/361] Restore translators comment --- includes/class-wc-cart-session.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class-wc-cart-session.php b/includes/class-wc-cart-session.php index 45a68537926..a229cd6409a 100644 --- a/includes/class-wc-cart-session.php +++ b/includes/class-wc-cart-session.php @@ -130,7 +130,7 @@ final class WC_Cart_Session { } elseif ( ! $product->is_purchasable() ) { $update_cart_session = true; - /* translators: %1$s: product name. %2$s reason why */ + /* translators: %s: product name */ $message = sprintf( __( '%s has been removed from your cart because it can no longer be purchased. Please contact us if you need assistance.', 'woocommerce' ), $product->get_name() ); /** * Filter message about item removed from the cart. From 972f7a49e27757e12c5b230ba5f614393ecb8fb7 Mon Sep 17 00:00:00 2001 From: Rodrigo Primo Date: Wed, 31 Jul 2019 16:21:19 -0300 Subject: [PATCH 053/361] Fix position of ID section in mobile rows actions This commit fixes the position of the ID section in mobile rows actions when displaying the list of products in the admin. --- assets/css/admin.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/assets/css/admin.scss b/assets/css/admin.scss index 6da58602921..58e4fbd6744 100644 --- a/assets/css/admin.scss +++ b/assets/css/admin.scss @@ -2757,6 +2757,10 @@ table.wp-list-table { color: #999; } + .row-actions span.id { + padding-top: 8px; + } + td.column-thumb img { margin: 0; width: auto; From 1e6785f7581ece6aed487aea041b6dc7beab120c Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Wed, 31 Jul 2019 17:37:33 -0300 Subject: [PATCH 054/361] Introduced filter to prevent adjust product stock --- includes/admin/wc-admin-functions.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/includes/admin/wc-admin-functions.php b/includes/admin/wc-admin-functions.php index 0a6f1bf24f3..beb3c60964a 100644 --- a/includes/admin/wc-admin-functions.php +++ b/includes/admin/wc-admin-functions.php @@ -194,6 +194,18 @@ function wc_maybe_adjust_line_item_product_stock( $item, $item_quantity = -1 ) { return false; } + /** + * Prevent adjust line item product stock. + * + * @since 3.7.1 + * @param bool $prevent If should prevent. + * @param WC_Order_Item $item Item object. + * @param int $item_quantity Optional quantity to check against. + */ + if ( apply_filters( 'woocommerce_prevent_adjust_line_item_product_stock', false, $item, $item_quantity ) ) { + return false; + } + $product = $item->get_product(); $item_quantity = wc_stock_amount( $item_quantity >= 0 ? $item_quantity : $item->get_quantity() ); $already_reduced_stock = wc_stock_amount( $item->get_meta( '_reduced_stock', true ) ); From 1ece5e1310bcbe8ce102b70a9ce4041e82b3c0bb Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Wed, 31 Jul 2019 18:31:49 -0300 Subject: [PATCH 055/361] Introduced woocommerce_sort_fees_callback filter --- includes/class-wc-cart-fees.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/includes/class-wc-cart-fees.php b/includes/class-wc-cart-fees.php index 22c23968dfe..6f5a29f5203 100644 --- a/includes/class-wc-cart-fees.php +++ b/includes/class-wc-cart-fees.php @@ -131,12 +131,20 @@ final class WC_Cart_Fees { /** * Sort fees by amount. * - * @param WC_Coupon $a Coupon object. - * @param WC_Coupon $b Coupon object. + * @param stdClass $a Fee object. + * @param stdClass $b Fee object. * @return int */ protected function sort_fees_callback( $a, $b ) { - return ( $a->amount > $b->amount ) ? -1 : 1; + /** + * Filter sort fees callback. + * + * @since 3.8.0 + * @param int Sort order, -1 or 1. + * @param stdClass $a Fee object. + * @param stdClass $b Fee object. + */ + return apply_filters( 'woocommerce_sort_fees_callback', $a->amount > $b->amount ? -1 : 1, $a, $b ); } /** From e9c6c06a81e33489dec0f5843f290afba2ed75b1 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Wed, 31 Jul 2019 20:34:11 -0300 Subject: [PATCH 056/361] Use default redirect page --- templates/myaccount/dashboard.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/myaccount/dashboard.php b/templates/myaccount/dashboard.php index 07db6dc09eb..ab34381335a 100644 --- a/templates/myaccount/dashboard.php +++ b/templates/myaccount/dashboard.php @@ -23,11 +23,11 @@ if ( ! defined( 'ABSPATH' ) ) { ?>

Log out)', 'woocommerce' ), '' . esc_html( $current_user->display_name ) . '', - esc_url( wc_logout_url( wc_get_page_permalink( 'myaccount' ) ) ) + esc_url( wc_logout_url() ) ); ?>

From 52ba85c977983cd2135a407530106fca678dc1c8 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Wed, 31 Jul 2019 20:35:10 -0300 Subject: [PATCH 057/361] Introduced filter to change default redirect url in wc_logout_url() --- includes/wc-template-functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/wc-template-functions.php b/includes/wc-template-functions.php index 52fad46dc83..e8e50d18b91 100644 --- a/includes/wc-template-functions.php +++ b/includes/wc-template-functions.php @@ -3480,7 +3480,7 @@ function wc_get_price_html_from_text() { * @return string */ function wc_logout_url( $redirect = '' ) { - $redirect = $redirect ? $redirect : wc_get_page_permalink( 'myaccount' ); + $redirect = $redirect ? $redirect : apply_filters( 'woocommerce_logout_default_redirect_url', wc_get_page_permalink( 'myaccount' ) ); if ( get_option( 'woocommerce_logout_endpoint' ) ) { return wp_nonce_url( wc_get_endpoint_url( 'customer-logout', '', $redirect ), 'customer-logout' ); From c4afd53749c128afb61d0e00fd6e22d46c8fcea5 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Wed, 31 Jul 2019 20:57:55 -0300 Subject: [PATCH 058/361] Make wc_get_endpoint_url() compatible with WordPress use_trailing_slashes settings --- includes/wc-page-functions.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/includes/wc-page-functions.php b/includes/wc-page-functions.php index 1b6c8220cd3..230fab498b9 100644 --- a/includes/wc-page-functions.php +++ b/includes/wc-page-functions.php @@ -101,10 +101,12 @@ function wc_get_endpoint_url( $endpoint, $value = '', $permalink = '' ) { } else { $query_string = ''; } - $url = trailingslashit( $permalink ) . trailingslashit( $endpoint ); + $url = trailingslashit( $permalink ); if ( $value ) { - $url .= trailingslashit( $value ); + $url .= trailingslashit( $endpoint ) . user_trailingslashit( $value ); + } else { + $url .= user_trailingslashit( $endpoint ); } $url .= $query_string; From 1189b1d066b5b18d7c1b3a43861fa0c017ab3722 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Thu, 1 Aug 2019 01:42:45 +0000 Subject: [PATCH 059/361] Update dependency grunt-stylelint to v0.11.1 --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 85bdf51abc8..367fc13d293 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5679,9 +5679,9 @@ } }, "grunt-stylelint": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/grunt-stylelint/-/grunt-stylelint-0.11.0.tgz", - "integrity": "sha512-/6LOPh8ftRS70tKa676ZrGG+eNCQQHJPH5QWe4gmzdW+K3Ud0YwbmUe1Bly3x9ymfllNTCALRmMJoV9xEh9RFA==", + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/grunt-stylelint/-/grunt-stylelint-0.11.1.tgz", + "integrity": "sha512-DYq74oCsk6Q/fmUarv4CGrt6M/61yrtHRSM5FfrJy8uLFo+WQ/tiMWmROk+53Vvq3GWz8+m/Rz/Ne+Ag0QZvjw==", "dev": true, "requires": { "chalk": "2.4.2" diff --git a/package.json b/package.json index bc605032b41..9de70b6bd40 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "grunt-rtlcss": "2.0.1", "grunt-sass": "3.0.2", "grunt-shell": "3.0.1", - "grunt-stylelint": "0.11.0", + "grunt-stylelint": "0.11.1", "grunt-wp-i18n": "1.0.3", "husky": "3.0.2", "istanbul": "1.0.0-alpha.2", From cd5319e97f2bfbba35f4920a78e31d92674f2137 Mon Sep 17 00:00:00 2001 From: Gerhard Date: Thu, 1 Aug 2019 11:35:17 +0200 Subject: [PATCH 060/361] Make master 3.8 dev branch, move changelogs from readme.txt to changelog.txt and start new 3.8 changelog in readme.txt. --- CHANGELOG.txt | 131 ++++++++++++++++++++++++++++++++++++++++++++++++ readme.txt | 103 +------------------------------------ woocommerce.php | 2 +- 3 files changed, 134 insertions(+), 102 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index f664926f991..27e8477cccb 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,5 +1,136 @@ == Changelog == += 3.7.0 - 2019-08-12 = +* Enhancement - Added table ENGINE to system status report for debugging purposes. #23101 +* Enhancement - Format empty cart message as information notice. #23152 +* Enhancement - Add taxonomy-specific classes to active filters widget. #23122 +* Enhancement - Allow emails `Thanks` wording to be modified via the email settings. #22927 +* Enhancement - Move tax classes from WordPress Options to a new `wc_tax_rate_classes` table. #23093 +* Enhancement - Make WooCommerce shop roles translatable. #23150 +* Enhancement - Prevent the Cart, Checkout and My Account pages from being set to the same pages. #23479 +* Enhancement - New coupon code generate button on the coupon page. #24069 +* Enhancement - Add `tag_operator` paramater to the `[products]` shortcode for use with the `tag` paramater ie. `[products tag='tag1,tag2' tag_operator='AND']`. #24111 +* Tweak - When cleaning up variations due to product type change, force delete them instead of trashing. #23478 +* Tweak - Change wording on the link to change the address so reflect if an address is already present or not. #23532 +* Tweak - If variations are missing prices, show a notice in the product data panel. #23133 +* Tweak - Use `determine_locale()` to properly load custom translation files. #23785 +* Tweak - OBW: Switch shipping labels and shipping zones placement. #23781 +* Tweak - Show the quantity refunded on customer facing order screens. #23038 +* Tweak - CSV product import now allows true/false values for the published field, as well as the original 0 (private), -1 (draft), 1 (publish) values. #23207 +* Tweak - Update product attribute sorting tooltip to clarify usage. #23222 +* Tweak - Store tax rate percentage in the tax line items on orders. #23268 +* Tweak - Remove the left and right margin from the logo in emails. #23360 +* Tweak - Use the high res version of the WP spinner in the coupon Block UI. #23364 +* Tweak - Improve user registration validation messages. #23468 +* Tweak - Auto generate a new username when a username is blacklisted by WordPress. #23672 +* Tweak - Guest cart sessions now gets deleted when a user logs in, preventing duplicate cart sessions. #23687 +* Tweak - Include the store's base postcode and city when calculating order taxes. #23695 +* Tweak - Update the generate username setting description label to reflect how the username is actually generated. #23911 +* Tweak - OBW: Adjust plugin highlight container sizes to avoid overlap. #23997 +* Tweak - Round tax amounts late when the round at subtotal level setting is enabled to reduce rounding errors. #24024 +* Tweak - OBW: Now includes WooCommerce Admin as a recommended plugin. #24058 +* Template - Review and update all template files escaping. #23460 +* Template - Remove mention of shipping section from the checkout/form-login.php template as shipping is not always a requirement for an order. #23941 +* Template - Add new filter `woocommerce_before_thankyou` to the checkout/thankyou.php template. #23538 +* Template - Add new `woocommerce_widget_shopping_cart_total` hook to replace hardcoded subtotal in cart/mini-cart.php template. #24145 +* Template - Add new `woocommerce_widget_shopping_cart_after_buttons` hook in cart/mini-cart.php template. #24145 +* Template - Add new `woocommerce_before_cart_collaterals` hook in cart/cart.php template. #24145 +* Template - Correct the plural forms usage in loop/result-count.php template. #24005 +* Dev - Introduce new PHP 5.6 minimum requirement. #23924 +* Dev - Introduce new WordPress 4.9 minimum requirement. #24156 +* Dev - Move the settings save functionality from the `settings_page_init` function to the `wp_loaded` action so it is not saved after the settings page renders. #23091 +* Dev - Add quantity input action hooks `woocommerce_before_add_to_cart_quantity` and `woocommerce_after_add_to_cart_quantity`. #23166 +* Dev - Add `$this` parameter to email class filters. #23250 +* Dev - Add new `WC_Abstract_Order::get_coupons()` method for returning all coupon line item objects on an order. #23663 +* Dev - Added new action `woocommerce_product_read` to `WC_Product_Data_Store_CPT::read()`. #23181 +* Dev - Add new filter `woocommerce_admin_order_buyer_name` to the `WC_Admin_List_Table_Orders::render_order_number_column()` method to change the buyer name in orders list screen. #23741 +* Dev - Add new actions to `WC_Helper` class for when WooCommerce.com Product Subscription statuses change `woocommerce_helper_subscription_activate_success`, `woocommerce_helper_subscription_activate_error`, `woocommerce_helper_subscription_deactivate_success`, and `woocommerce_helper_subscription_deactivate_error`. #23041 +* Dev - Extend usage and event tracking (if opted in) to system status, admin order and admin coupon pages. #23190 #23189 #23883 +* Dev - Add `woocommerce_after_X_object_save` actions, and passed objects to `woocommerce_new_x` and `woocommerce_update_x` actions. #23338 +* Dev - Update customer order and lifetime spend totals in `wc_update_new_customer_past_orders()` to trigger `customer.updated` webhooks for paid orders. #23402 +* Dev - Preserve the State field's custom css classes when selecting an option from the Country dropdown. #23433 +* Dev - Add new `woocommerce_product_related_posts_shuffle` filter in `wc_get_related_products()` to enable/disable related product shuffling, defaults to true. #23562 +* Dev - Deprecate the `WC_Abstract_Order::get_used_coupons()` method and replace it with a new method `WC_Abstract_Order::get_coupon_codes()`. #23689 +* Dev - Add new `woocommerce_prices_include_tax` filter in the `wc_prices_include_tax()` function. #23697 +* Dev - Add new `woocommerce_admin_after_product_gallery_item` filter in the `WC_Meta_Box_Product_Images::output()` method for adding additional markup after product gallery items. #23743 +* Dev - Remove unused images `assets/images/klarna-white.png` and `assets/images/square-white.png`. #23748 +* Dev - Move Free Shipping method JavaScript code from outputting on all shipping setting pages to just the Free Shipping page using the `admin_footer` hook. #23776 +* Dev - Prevent PHP fatal error while throwing exceptions in `woocommerce_rest_insert_{post_type}_object` hooks. #23793 +* Dev - Add new `woocommerce_enforce_password_strength_meter_on_checkout` filter in the `WC_Frontend_Scripts::get_script_data()` method to allow enforcing the password strength meter on checkout. #23811 +* Dev - Add new `woocommerce_search_products_post_statuses` filter in the `WC_Product_Data_Store_CPT::search_products()` method for controlling what post statuses to include in product searches. #23838 +* Dev - Allow filtering `woocommerce_order_formatted_shipping_address` even when no shipping address is defined. #23859 +* Dev - Change the query in the `WC_Product_Data_Store::find_matching_product_variation()` method to always respect the ordering of variations. #23881 +* Dev - Move all feature plugin features out from the WooCommerce codebase and utilize composer and an autoloader for including it in WooCommerce core, affects WC REST API and WC Blocks. #23957 +* Dev - Allow displaying multiple error messages through the registration validation. #23968 +* Dev - Add new `woocommerce_cart_item_removed_notice_type`, `woocommerce_cart_updated_notice_type` and `woocommerce_add_to_cart_notice_type` filters for changing the default notice types for cart notices. #24021 +* Dev - Add namespaced support for Jetpack 7.5 tracking library. #24140 +* Dev - Add support for an improved WooCommerce.com Marketplace browse and purchase experience (in progress). #24075 #24123 +* Dev - Added `$order` and `$product` as parameters to the `woocommerce_ajax_order_item` filter in `WC_Ajax::add_order_item()`. #24108 +* Dev - Add new `woocommerce_product_import_image_separator` filter in `WC_Product_CSV_Importer::parse_images_field()` for adjusting the product images seperator. #24120 +* Dev - Add new `woocommerce_widget_shopping_cart_subtotal()` template function that hooks into the `woocommerce_widget_shopping_cart_total` action to output the mini cart subtotal. #24145 +* Dev - Deprecate the `woocommerce_before_cart_item_quantity_zero` action from `WC_Cart::restore_cart_item()` in favor of existing `woocommerce_cart_item_removed` action. #23112 +* Dev - Deprecate WC_Tax::maybe_remove_tax_class_rates which hooked into the WP Options update hook for taxes in favor of new function WC_Tax::delete_tax_class_by which works on the new tax classes table. #24213 +* Fix - Use version_compare for determining the maximum WooCommerce database version number. #23092 +* Fix - Missing space and closing `` tag in WooCommerce.com disconnect message. #24073 +* Fix - CSV Importer - Skip rows during update if a SKU column exists, but the value is empty. #23262 +* Fix - Allow matching `Any` attributes when calling `WC_Product_Data_Store::find_matching_product_variation()`. #23067 +* Fix - Switch coupon amount validation based on decimal seperator setting. #23137 +* Fix - Show the correct results for shortcodes on static homepages when sorting. #23159 +* Fix - Queue AJAX add to cart events to avoid overwriting session data. #23293 +* Fix - Wrong subtotals when changing tax classes via the `woocommerce_product_get_tax_class` filter. #23344 +* Fix - Fatal error on plain text order emails where products were deleted. #23754 +* Fix - Do not pass the `no_shipping` argument to PayPal when the order contains shippable items. #23773 +* Fix - Product review form does respects the `require_name_email` WordPress core option. #23786 +* Fix - Do not cache expired sessions, negative expiry causes errors in some caching modules. #23863 +* Fix - WC_Log_Handler_DB logs now uses the same timestamp format as text logs, Y-m-d H:i:s. #23863 +* Fix - Display line breaks for customer notes in emails, and order details. #23969 +* Fix - Correct plural forms usage in `WC_Admin_Report` class. #24020 +* Fix - System status database info section throwing a PHP notice on some DB environments. #24023 +* Fix - On the system status database info section display a message informing users that WooCommerce was unable to get database information instead of an error, when a database sharding plugin is active. #24034 +* Fix - Usage and event tracking (if opted in) was not working correctly in the OBW. #24056 +* Fix - Fatal error on downloads report when some download files were missing. #24118 +* Fix - Prevents the taxes columns from being removed when the order is no longer editable in admin. #23884 +* Performance - Improve the speed of the admin dashboard by only updating transients once per class. #23011 +* Performance - Reduce number of queries needed to populate variations data by priming post caches. #23272 +* Performance - Persistant cart improvements, only update the persistent cart if the cart items actually change. #23112 +* Performance - Exclude `action_log` comment types from `wp_count_comments`. #24071 +* Localization - Added validation for Italian postcodes. #23269 +* Localization - Remove unused tax locale defaults since we now promote auto tax services instead. #23431 +* Localization - Define correct address format for Uganda. #23178 +* Localization - Hide the postcode and update the state label to "Province" for Mozambique. #23764 +* Localization - OBW: Make postal code optional based on locale data. #23915 +* Localization - Add new currency for São Tomé, Príncipe dobra and Mauritanian ouguiya. #23950 +* Localization - Change Canada poscode label to `Postal code`. #23740 + += 3.6.5 - 2019-07-02 = +* Security - Introduce file type check for tax rate importer. +* Security - Added nonce check to CSV importer actions. +* Enhancement - WordPress & PHP upgrade nudges when running older versions. #23975 +* Fix - "Filter by price" widget excludes category when combined with a product attribute. #23720 +* Fix - Add query parameter (GET) forwarding when processing batch API requests. #23769 +* Fix - Fixed query of top rated products shortcode. #23771 +* Fix - Typo in customers endpoint schema. #23812 +* Fix - Update Emogrifier library to fix problem with nth-child pseudo selector. #23824 +* Fix - Avoid outputting a rating of zero when product has comments without a review rating. #23828 +* Fix - Do not throw a PHP notice if including the rest API handlers manually. #23840 +* Fix - WooCommerce Tracker review count. #23849 +* Fix - Coupon usage limit issue when applying coupon to order in the backend. #23851 +* Fix - Fatal error when trying to apply virtual coupons to guest orders. #23877 +* Fix - AJAX update order review doesn't reload the page. #23891 +* Fix - Variation matching returns incorrect values when using a large number of variations combined with 0 values attributes. #23909 +* Fix - Password mismatch when user registered with password containing a double quote. #23926 +* Fix - Minor Shipping Zone UI issue due to conflict with some browser extensions. #23789 +* Fix - Make Products->Categories active when clicked on "Make Default" link under any product category. #23936 +* Fix - Update URL describing how to increase PHP memory limit on system status page. #23919 +* Fix - Sets the position of the tracking image to fixed, so it doesn't affect page layout. #23953 +* Fix - Button to manually update database in WooCommerce > Status > Tools. #23966 +* Fix - Tracks blog ID retrieval from Jetpack options. #24028 +* Fix - Fixed support to parentheses in phone numbers validation. #23967 +* Tweak - Improve tooltip text describing the product sale dates in the product admin page. #23935 +* Tweak - Made NL postcode validation more flexible, allowing lowercase and missing space. #23837 +* Localization - Display city field as optional for Singapore addresses. #23878 +* Dev - Add filters to file paths passed to the different xsendfile like backends. #23814 + = 3.6.4 - 2019-05-27 = * Enhancement - Add notice to install WooCommerce Admin. #23659 * Fix - Tracks: Add check for OBW is-opting-in. #23772 diff --git a/readme.txt b/readme.txt index 95424127fcd..dc065e0c4f4 100644 --- a/readme.txt +++ b/readme.txt @@ -179,107 +179,8 @@ INTERESTED IN DEVELOPMENT? == Changelog == -= 3.7.0 - 2019-xx-xx = -* Enhancement - Added table ENGINE to system status report for debugging purposes. #23101 -* Enhancement - Format empty cart message as information notice. #23152 -* Enhancement - Add taxonomy-specific classes to active filters widget. #23122 -* Enhancement - Allow emails `Thanks` wording to be modified via the email settings. #22927 -* Enhancement - Move tax classes from WordPress Options to a new `wc_tax_rate_classes` table. #23093 -* Enhancement - Make WooCommerce shop roles translatable. #23150 -* Enhancement - Prevent the Cart, Checkout and My Account pages from being set to the same pages. #23479 -* Enhancement - New coupon code generate button on the coupon page. #24069 -* Enhancement - Add `tag_operator` paramater to the `[products]` shortcode for use with the `tag` paramater ie. `[products tag='tag1,tag2' tag_operator='AND']`. #24111 -* Tweak - When cleaning up variations due to product type change, force delete them instead of trashing. #23478 -* Tweak - Change wording on the link to change the address so reflect if an address is already present or not. #23532 -* Tweak - If variations are missing prices, show a notice in the product data panel. #23133 -* Tweak - Use `determine_locale()` to properly load custom translation files. #23785 -* Tweak - OBW: Switch shipping labels and shipping zones placement. #23781 -* Tweak - Show the quantity refunded on customer facing order screens. #23038 -* Tweak - CSV product import now allows true/false values for the published field, as well as the original 0 (private), -1 (draft), 1 (publish) values. #23207 -* Tweak - Update product attribute sorting tooltip to clarify usage. #23222 -* Tweak - Store tax rate percentage in the tax line items on orders. #23268 -* Tweak - Remove the left and right margin from the logo in emails. #23360 -* Tweak - Use the high res version of the WP spinner in the coupon Block UI. #23364 -* Tweak - Improve user registration validation messages. #23468 -* Tweak - Auto generate a new username when a username is blacklisted by WordPress. #23672 -* Tweak - Guest cart sessions now gets deleted when a user logs in, preventing duplicate cart sessions. #23687 -* Tweak - Include the store's base postcode and city when calculating order taxes. #23695 -* Tweak - Update the generate username setting description label to reflect how the username is actually generated. #23911 -* Tweak - OBW: Adjust plugin highlight container sizes to avoid overlap. #23997 -* Tweak - Round tax amounts late when the round at subtotal level setting is enabled to reduce rounding errors. #24024 -* Tweak - OBW: Now includes WooCommerce Admin as a recommended plugin. #24058 -* Template - Review and update all template files escaping. #23460 -* Template - Remove mention of shipping section from the checkout/form-login.php template as shipping is not always a requirement for an order. #23941 -* Template - Add new filter `woocommerce_before_thankyou` to the checkout/thankyou.php template. #23538 -* Template - Add new `woocommerce_widget_shopping_cart_total` hook to replace hardcoded subtotal in cart/mini-cart.php template. #24145 -* Template - Add new `woocommerce_widget_shopping_cart_after_buttons` hook in cart/mini-cart.php template. #24145 -* Template - Add new `woocommerce_before_cart_collaterals` hook in cart/cart.php template. #24145 -* Template - Correct the plural forms usage in loop/result-count.php template. #24005 -* Dev - Introduce new PHP 5.6 minimum requirement. #23924 -* Dev - Introduce new WordPress 4.9 minimum requirement. #24156 -* Dev - Move the settings save functionality from the `settings_page_init` function to the `wp_loaded` action so it is not saved after the settings page renders. #23091 -* Dev - Add quantity input action hooks `woocommerce_before_add_to_cart_quantity` and `woocommerce_after_add_to_cart_quantity`. #23166 -* Dev - Add `$this` parameter to email class filters. #23250 -* Dev - Add new `WC_Abstract_Order::get_coupons()` method for returning all coupon line item objects on an order. #23663 -* Dev - Added new action `woocommerce_product_read` to `WC_Product_Data_Store_CPT::read()`. #23181 -* Dev - Add new filter `woocommerce_admin_order_buyer_name` to the `WC_Admin_List_Table_Orders::render_order_number_column()` method to change the buyer name in orders list screen. #23741 -* Dev - Add new actions to `WC_Helper` class for when WooCommerce.com Product Subscription statuses change `woocommerce_helper_subscription_activate_success`, `woocommerce_helper_subscription_activate_error`, `woocommerce_helper_subscription_deactivate_success`, and `woocommerce_helper_subscription_deactivate_error`. #23041 -* Dev - Extend usage and event tracking (if opted in) to system status, admin order and admin coupon pages. #23190 #23189 #23883 -* Dev - Add `woocommerce_after_X_object_save` actions, and passed objects to `woocommerce_new_x` and `woocommerce_update_x` actions. #23338 -* Dev - Update customer order and lifetime spend totals in `wc_update_new_customer_past_orders()` to trigger `customer.updated` webhooks for paid orders. #23402 -* Dev - Preserve the State field's custom css classes when selecting an option from the Country dropdown. #23433 -* Dev - Add new `woocommerce_product_related_posts_shuffle` filter in `wc_get_related_products()` to enable/disable related product shuffling, defaults to true. #23562 -* Dev - Deprecate the `WC_Abstract_Order::get_used_coupons()` method and replace it with a new method `WC_Abstract_Order::get_coupon_codes()`. #23689 -* Dev - Add new `woocommerce_prices_include_tax` filter in the `wc_prices_include_tax()` function. #23697 -* Dev - Add new `woocommerce_admin_after_product_gallery_item` filter in the `WC_Meta_Box_Product_Images::output()` method for adding additional markup after product gallery items. #23743 -* Dev - Remove unused images `assets/images/klarna-white.png` and `assets/images/square-white.png`. #23748 -* Dev - Move Free Shipping method JavaScript code from outputting on all shipping setting pages to just the Free Shipping page using the `admin_footer` hook. #23776 -* Dev - Prevent PHP fatal error while throwing exceptions in `woocommerce_rest_insert_{post_type}_object` hooks. #23793 -* Dev - Add new `woocommerce_enforce_password_strength_meter_on_checkout` filter in the `WC_Frontend_Scripts::get_script_data()` method to allow enforcing the password strength meter on checkout. #23811 -* Dev - Add new `woocommerce_search_products_post_statuses` filter in the `WC_Product_Data_Store_CPT::search_products()` method for controlling what post statuses to include in product searches. #23838 -* Dev - Allow filtering `woocommerce_order_formatted_shipping_address` even when no shipping address is defined. #23859 -* Dev - Change the query in the `WC_Product_Data_Store::find_matching_product_variation()` method to always respect the ordering of variations. #23881 -* Dev - Move all feature plugin features out from the WooCommerce codebase and utilize composer and an autoloader for including it in WooCommerce core, affects WC REST API and WC Blocks. #23957 -* Dev - Allow displaying multiple error messages through the registration validation. #23968 -* Dev - Add new `woocommerce_cart_item_removed_notice_type`, `woocommerce_cart_updated_notice_type` and `woocommerce_add_to_cart_notice_type` filters for changing the default notice types for cart notices. #24021 -* Dev - Add namespaced support for Jetpack 7.5 tracking library. #24140 -* Dev - Add support for an improved WooCommerce.com Marketplace browse and purchase experience (in progress). #24075 #24123 -* Dev - Added `$order` and `$product` as parameters to the `woocommerce_ajax_order_item` filter in `WC_Ajax::add_order_item()`. #24108 -* Dev - Add new `woocommerce_product_import_image_separator` filter in `WC_Product_CSV_Importer::parse_images_field()` for adjusting the product images seperator. #24120 -* Dev - Add new `woocommerce_widget_shopping_cart_subtotal()` template function that hooks into the `woocommerce_widget_shopping_cart_total` action to output the mini cart subtotal. #24145 -* Dev - Deprecate the `woocommerce_before_cart_item_quantity_zero` action from `WC_Cart::restore_cart_item()` in favor of existing `woocommerce_cart_item_removed` action. #23112 -* Dev - Deprecate WC_Tax::maybe_remove_tax_class_rates which hooked into the WP Options update hook for taxes in favor of new function WC_Tax::delete_tax_class_by which works on the new tax classes table. #24213 -* Fix - Use version_compare for determining the maximum WooCommerce database version number. #23092 -* Fix - Missing space and closing `` tag in WooCommerce.com disconnect message. #24073 -* Fix - CSV Importer - Skip rows during update if a SKU column exists, but the value is empty. #23262 -* Fix - Allow matching `Any` attributes when calling `WC_Product_Data_Store::find_matching_product_variation()`. #23067 -* Fix - Switch coupon amount validation based on decimal seperator setting. #23137 -* Fix - Show the correct results for shortcodes on static homepages when sorting. #23159 -* Fix - Queue AJAX add to cart events to avoid overwriting session data. #23293 -* Fix - Wrong subtotals when changing tax classes via the `woocommerce_product_get_tax_class` filter. #23344 -* Fix - Fatal error on plain text order emails where products were deleted. #23754 -* Fix - Do not pass the `no_shipping` argument to PayPal when the order contains shippable items. #23773 -* Fix - Product review form does respects the `require_name_email` WordPress core option. #23786 -* Fix - Do not cache expired sessions, negative expiry causes errors in some caching modules. #23863 -* Fix - WC_Log_Handler_DB logs now uses the same timestamp format as text logs, Y-m-d H:i:s. #23863 -* Fix - Display line breaks for customer notes in emails, and order details. #23969 -* Fix - Correct plural forms usage in `WC_Admin_Report` class. #24020 -* Fix - System status database info section throwing a PHP notice on some DB environments. #24023 -* Fix - On the system status database info section display a message informing users that WooCommerce was unable to get database information instead of an error, when a database sharding plugin is active. #24034 -* Fix - Usage and event tracking (if opted in) was not working correctly in the OBW. #24056 -* Fix - Fatal error on downloads report when some download files were missing. #24118 -* Fix - Prevents the taxes columns from being removed when the order is no longer editable in admin. #23884 -* Performance - Improve the speed of the admin dashboard by only updating transients once per class. #23011 -* Performance - Reduce number of queries needed to populate variations data by priming post caches. #23272 -* Performance - Persistant cart improvements, only update the persistent cart if the cart items actually change. #23112 -* Performance - Exclude `action_log` comment types from `wp_count_comments`. #24071 -* Localization - Added validation for Italian postcodes. #23269 -* Localization - Remove unused tax locale defaults since we now promote auto tax services instead. #23431 -* Localization - Define correct address format for Uganda. #23178 -* Localization - Hide the postcode and update the state label to "Province" for Mozambique. #23764 -* Localization - OBW: Make postal code optional based on locale data. #23915 -* Localization - Add new currency for São Tomé, Príncipe dobra and Mauritanian ouguiya. #23950 -* Localization - Change Canada poscode label to `Postal code`. #23740 += 3.8.0 - 2019-11-08 = + [See changelog for all versions](https://raw.githubusercontent.com/woocommerce/woocommerce/master/CHANGELOG.txt). diff --git a/woocommerce.php b/woocommerce.php index e6d11ed569a..51993d52eb9 100644 --- a/woocommerce.php +++ b/woocommerce.php @@ -3,7 +3,7 @@ * Plugin Name: WooCommerce * Plugin URI: https://woocommerce.com/ * Description: An eCommerce toolkit that helps you sell anything. Beautifully. - * Version: 3.7.0-rc.1 + * Version: 3.8.0-dev * Author: Automattic * Author URI: https://woocommerce.com * Text Domain: woocommerce From 2773fd082ce1ec020c05f3dbf3a685398d7402d8 Mon Sep 17 00:00:00 2001 From: Rodrigo Primo Date: Thu, 1 Aug 2019 11:09:48 -0300 Subject: [PATCH 061/361] Remove WooCommerce market share from the CONTRIBUTING.md file --- .github/CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 02e936ccfc2..b0dceae2b21 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -1,6 +1,6 @@ # Contributing to WooCommerce ✨ -WooCommerce currently powers 30% of all online stores across the internet, and your help making it even more awesome will be greatly appreciated :) +WooCommerce powers several online stores across the internet, and your help making it even more awesome will be greatly appreciated :) There are many ways to contribute to the project! From 14fa191322babac9e515d710b85674e3e422415a Mon Sep 17 00:00:00 2001 From: Rodrigo Primo Date: Thu, 1 Aug 2019 11:43:48 -0300 Subject: [PATCH 062/361] Replace "several" with "many" in the first sentence --- .github/CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index b0dceae2b21..e56540e1b4f 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -1,6 +1,6 @@ # Contributing to WooCommerce ✨ -WooCommerce powers several online stores across the internet, and your help making it even more awesome will be greatly appreciated :) +WooCommerce powers many online stores across the internet, and your help making it even more awesome will be greatly appreciated :) There are many ways to contribute to the project! From fb7dbd451b88ec5a9c82b63c989d3e2a95294075 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Thu, 1 Aug 2019 15:11:11 +0000 Subject: [PATCH 063/361] Update dependency woocommerce/woocommerce-blocks to v2.3.0-rc.1 --- composer.json | 2 +- composer.lock | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/composer.json b/composer.json index 204370cea6e..c2d91a1715f 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ "automattic/jetpack-autoloader": "1.2.0", "php": ">=5.6|>=7.0", "composer/installers": "1.6.0", - "woocommerce/woocommerce-blocks": "2.3.0-beta.3", + "woocommerce/woocommerce-blocks": "2.3.0-rc.1", "woocommerce/woocommerce-rest-api": "1.0.3" }, "require-dev": { diff --git a/composer.lock b/composer.lock index 310d6e94d4c..ccd04467472 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "9d1e096234a97eef4dba1acc58ed36b2", + "content-hash": "05557159b0c72dea312dfaf01083ec18", "packages": [ { "name": "automattic/jetpack-autoloader", @@ -164,16 +164,16 @@ }, { "name": "woocommerce/woocommerce-blocks", - "version": "v2.3.0-beta.3", + "version": "v2.3.0-rc.1", "source": { "type": "git", "url": "https://github.com/woocommerce/woocommerce-gutenberg-products-block.git", - "reference": "b23197a147a2eddbc36ba58742e82991dcf2866b" + "reference": "59d64079b98e5d8f18c1d436cd4f8fbc9471a649" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/woocommerce/woocommerce-gutenberg-products-block/zipball/b23197a147a2eddbc36ba58742e82991dcf2866b", - "reference": "b23197a147a2eddbc36ba58742e82991dcf2866b", + "url": "https://api.github.com/repos/woocommerce/woocommerce-gutenberg-products-block/zipball/59d64079b98e5d8f18c1d436cd4f8fbc9471a649", + "reference": "59d64079b98e5d8f18c1d436cd4f8fbc9471a649", "shasum": "" }, "require": { @@ -207,7 +207,7 @@ "gutenberg", "woocommerce" ], - "time": "2019-07-29T16:15:48+00:00" + "time": "2019-08-01T14:56:08+00:00" }, { "name": "woocommerce/woocommerce-rest-api", @@ -503,18 +503,18 @@ "authors": [ { "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" + "role": "Developer", + "email": "arne@blankerts.de" }, { "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" + "role": "Developer", + "email": "sebastian@phpeople.de" }, { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" + "role": "Developer", + "email": "sebastian@phpunit.de" } ], "description": "Library for handling version information and constraints", From ae4eba45ec62e8add53c229ff94e20bf5bd6f6bc Mon Sep 17 00:00:00 2001 From: Miguel Pinto Date: Thu, 1 Aug 2019 16:19:17 +0100 Subject: [PATCH 064/361] Update class-wc-gateway-paypal-response.php --- .../paypal/includes/class-wc-gateway-paypal-response.php | 1 + 1 file changed, 1 insertion(+) diff --git a/includes/gateways/paypal/includes/class-wc-gateway-paypal-response.php b/includes/gateways/paypal/includes/class-wc-gateway-paypal-response.php index 18048195128..7242a9f268b 100644 --- a/includes/gateways/paypal/includes/class-wc-gateway-paypal-response.php +++ b/includes/gateways/paypal/includes/class-wc-gateway-paypal-response.php @@ -68,6 +68,7 @@ abstract class WC_Gateway_Paypal_Response { $order->payment_complete( $txn_id ); WC()->cart->empty_cart(); $order->update_meta_data( '_paypal_payment_completed', 'yes' ); + $order->save(); } } From 009b0f030d2c96aa87e385c0f8dee1b13c9c81f4 Mon Sep 17 00:00:00 2001 From: Jesse Pearson Date: Thu, 1 Aug 2019 13:07:05 -0400 Subject: [PATCH 065/361] Sort shipping classes under products alphabetically --- includes/admin/meta-boxes/views/html-product-data-shipping.php | 1 + 1 file changed, 1 insertion(+) diff --git a/includes/admin/meta-boxes/views/html-product-data-shipping.php b/includes/admin/meta-boxes/views/html-product-data-shipping.php index c8ac5ef3a1d..8dc88c2a1d0 100644 --- a/includes/admin/meta-boxes/views/html-product-data-shipping.php +++ b/includes/admin/meta-boxes/views/html-product-data-shipping.php @@ -50,6 +50,7 @@ if ( ! defined( 'ABSPATH' ) ) { 'id' => 'product_shipping_class', 'selected' => $product_object->get_shipping_class_id( 'edit' ), 'class' => 'select short', + 'orderby' => 'name', ); ?>

From decea3d28c5bc745518cff794e696cb70a884f84 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Thu, 1 Aug 2019 15:55:32 -0300 Subject: [PATCH 066/361] Allow sort products by "include" order --- includes/data-stores/class-wc-product-data-store-cpt.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/includes/data-stores/class-wc-product-data-store-cpt.php b/includes/data-stores/class-wc-product-data-store-cpt.php index 61d765c35bf..811c15a63b6 100644 --- a/includes/data-stores/class-wc-product-data-store-cpt.php +++ b/includes/data-stores/class-wc-product-data-store-cpt.php @@ -1958,6 +1958,11 @@ class WC_Product_Data_Store_CPT extends WC_Data_Store_WP implements WC_Object_Da add_filter( 'posts_where', array( $this, 'reviews_allowed_query_where' ), 10, 2 ); } + // Handle orderby. + if ( isset( $query_vars['orderby'] ) && 'include' === $query_vars['orderby'] ) { + $wp_query_args['orderby'] = 'post__in'; + } + return apply_filters( 'woocommerce_product_data_store_cpt_get_products_query', $wp_query_args, $query_vars, $this ); } From d624bb57d5afb51fa740b839c5f844ba728eb788 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Thu, 1 Aug 2019 15:56:02 -0300 Subject: [PATCH 067/361] Fixed coding standards --- includes/data-stores/class-wc-product-data-store-cpt.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/data-stores/class-wc-product-data-store-cpt.php b/includes/data-stores/class-wc-product-data-store-cpt.php index 811c15a63b6..42cfd76b347 100644 --- a/includes/data-stores/class-wc-product-data-store-cpt.php +++ b/includes/data-stores/class-wc-product-data-store-cpt.php @@ -1088,7 +1088,7 @@ class WC_Product_Data_Store_CPT extends WC_Data_Store_WP implements WC_Object_Da $query .= ' AND postmeta.meta_key IN ( "' . implode( '","', array_map( 'esc_sql', $meta_attribute_names ) ) . '" )'; - $query.=' ORDER BY posts.menu_order ASC, postmeta.post_id ASC;'; + $query .= ' ORDER BY posts.menu_order ASC, postmeta.post_id ASC;'; $attributes = $wpdb->get_results( $query ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared From 833c5016ea73114dca7eb214f7b9a414e5866d04 Mon Sep 17 00:00:00 2001 From: Rodrigo Primo Date: Thu, 1 Aug 2019 17:21:30 -0300 Subject: [PATCH 068/361] Add unit tests for wc_get_endpoint_url() --- .../class-wc-tests-page-functions.php | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 tests/unit-tests/page-functions/class-wc-tests-page-functions.php diff --git a/tests/unit-tests/page-functions/class-wc-tests-page-functions.php b/tests/unit-tests/page-functions/class-wc-tests-page-functions.php new file mode 100644 index 00000000000..322a2d6d259 --- /dev/null +++ b/tests/unit-tests/page-functions/class-wc-tests-page-functions.php @@ -0,0 +1,46 @@ +assertEquals( 'https://example.org/?customer-logout=yes', $url ); + } + + /** + * Test wc_get_endpoint_url() when the option permalink_structure is set. + */ + public function test_wc_get_endpoint_url_should_add_endpoint_to_query_path() { + global $wp_rewrite; + + update_option( 'permalink_structure', '/%postname%/' ); + $wp_rewrite->use_trailing_slashes = true; + + $url = wc_get_endpoint_url( 'customer-logout', '', 'https://example.org/' ); + $this->assertEquals( 'https://example.org/customer-logout/', $url ); + + $url = wc_get_endpoint_url( 'customer-logout', 'yes', 'https://example.org/' ); + $this->assertEquals( 'https://example.org/customer-logout/yes/', $url ); + + $url = wc_get_endpoint_url( 'customer-logout', 'yes', 'https://example.org/?foo=bar' ); + $this->assertEquals( 'https://example.org/customer-logout/yes/?foo=bar', $url ); + + // test added after issue https://github.com/woocommerce/woocommerce/issues/24240. + update_option( 'permalink_structure', '/%postname%' ); + $wp_rewrite->use_trailing_slashes = false; + + $url = wc_get_endpoint_url( 'customer-logout', '', 'https://example.org/' ); + $this->assertEquals( 'https://example.org/customer-logout', $url ); + } +} From 843df9c8b93881cf3165b1eb3a1bd0b03629bf5c Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Thu, 1 Aug 2019 17:24:32 -0300 Subject: [PATCH 069/361] Remove %20 from strings when building a form from query strings --- includes/wc-template-functions.php | 1 - 1 file changed, 1 deletion(-) diff --git a/includes/wc-template-functions.php b/includes/wc-template-functions.php index e8e50d18b91..176db1dcdb6 100644 --- a/includes/wc-template-functions.php +++ b/includes/wc-template-functions.php @@ -709,7 +709,6 @@ function wc_query_string_form_fields( $values = null, $exclude = array(), $curre $replace_chars = array( '.' => '{dot}', '+' => '{plus}', - '%20' => '{space}', ); $query_string = str_replace( array_keys( $replace_chars ), array_values( $replace_chars ), $url_parts['query'] ); From 162c5dd8a2697951e6e424962c3ba80ffa8d9a77 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Thu, 1 Aug 2019 17:30:39 -0300 Subject: [PATCH 070/361] Updated tests for wc_query_string_form_fields() --- tests/unit-tests/templates/functions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit-tests/templates/functions.php b/tests/unit-tests/templates/functions.php index 48bafed9cb9..b1e8e4e5043 100644 --- a/tests/unit-tests/templates/functions.php +++ b/tests/unit-tests/templates/functions.php @@ -135,11 +135,11 @@ class WC_Tests_Template_Functions extends WC_Unit_Test_Case { $this->assertEquals( $expected_html, $actual_html ); $actual_html = wc_query_string_form_fields( '?test+something=something+else', array(), '', true ); - $expected_html = ''; + $expected_html = ''; $this->assertEquals( $expected_html, $actual_html ); $actual_html = wc_query_string_form_fields( '?test%20something=something%20else', array(), '', true ); - $expected_html = ''; + $expected_html = ''; $this->assertEquals( $expected_html, $actual_html ); } } From 243b435139efa5f7970813edd126d95e1cd803aa Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Thu, 1 Aug 2019 17:49:03 -0300 Subject: [PATCH 071/361] Restored Photoswipe custom styles --- assets/css/photoswipe/photoswipe.css | 32 ++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/assets/css/photoswipe/photoswipe.css b/assets/css/photoswipe/photoswipe.css index 0ca0f802889..59a4c2bf4f0 100755 --- a/assets/css/photoswipe/photoswipe.css +++ b/assets/css/photoswipe/photoswipe.css @@ -1,3 +1,35 @@ +/** + * WooCommerce Photoswipe styles. + * 1. These styles are required to overwrite default theme button styles (Twenty Twelve adds gradients via background-image). + * 2. For zooming on mobile. + */ +.woocommerce img.pswp__img, +.woocommerce-page img.pswp__img { + max-width: none; /* 2 */ +} +button.pswp__button { + box-shadow: none !important; + background-image: url('default-skin/default-skin.png') !important; +} +button.pswp__button, +button.pswp__button:hover, +button.pswp__button--arrow--left::before, +button.pswp__button--arrow--right::before { + background-color: transparent !important; /* 1 */ +} +button.pswp__button--arrow--left, +button.pswp__button--arrow--right, +button.pswp__button--arrow--left:hover, +button.pswp__button--arrow--right:hover { + background-image: none !important; /* 1 */ +} +button.pswp__button--close:hover { + background-position: 0 -44px; +} +button.pswp__button--zoom:hover { + background-position: -88px 0; +} + /*! PhotoSwipe main CSS by Dmitry Semenov | photoswipe.com | MIT license */ /* Styles for basic PhotoSwipe functionality (sliding area, open/close transitions) From 1b4ac250a779b2131afadeccb347c21c0e27465b Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Thu, 1 Aug 2019 19:12:29 -0300 Subject: [PATCH 072/361] Change wording to "Browse products" --- templates/myaccount/downloads.php | 2 +- templates/myaccount/orders.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/myaccount/downloads.php b/templates/myaccount/downloads.php index 7e0f6ca8193..b06139e050b 100644 --- a/templates/myaccount/downloads.php +++ b/templates/myaccount/downloads.php @@ -37,7 +37,7 @@ do_action( 'woocommerce_before_account_downloads', $has_downloads ); ?>

diff --git a/templates/myaccount/orders.php b/templates/myaccount/orders.php index f12f7b14141..aacbd2ef6d3 100644 --- a/templates/myaccount/orders.php +++ b/templates/myaccount/orders.php @@ -98,7 +98,7 @@ do_action( 'woocommerce_before_account_orders', $has_orders ); ?> From 0d80af01dce2dae04da2783fcb97e810492a2b92 Mon Sep 17 00:00:00 2001 From: Luis Date: Fri, 2 Aug 2019 00:10:11 -0300 Subject: [PATCH 073/361] Fixing code standards violations --- .../widgets/class-wc-widget-price-filter.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/includes/widgets/class-wc-widget-price-filter.php b/includes/widgets/class-wc-widget-price-filter.php index 09bc664a305..f694753cae8 100644 --- a/includes/widgets/class-wc-widget-price-filter.php +++ b/includes/widgets/class-wc-widget-price-filter.php @@ -120,14 +120,17 @@ class WC_Widget_Price_Filter extends WC_Widget { $form_action = preg_replace( '%\/page/[0-9]+%', '', home_url( trailingslashit( $wp->request ) ) ); } - wc_get_template( 'content-widget-price-filter.php', array( - 'form_action' => $form_action, - 'step' => $step, - 'min_price' => $min_price, - 'max_price' => $max_price, - 'current_min_price' => $current_min_price, - 'current_max_price' => $current_max_price - ) ); + wc_get_template( + 'content-widget-price-filter.php', + array( + 'form_action' => $form_action, + 'step' => $step, + 'min_price' => $min_price, + 'max_price' => $max_price, + 'current_min_price' => $current_min_price, + 'current_max_price' => $current_max_price, + ) + ); $this->widget_end( $args ); } From 21df7c65467406ea95a24565985fc095da3fbc85 Mon Sep 17 00:00:00 2001 From: Gerhard Date: Fri, 2 Aug 2019 13:15:25 +0200 Subject: [PATCH 074/361] Move 3.7 changelog out of changelog.txt and back into readme.txt --- CHANGELOG.txt | 102 -------------------------------------------------- readme.txt | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+), 102 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 27e8477cccb..7e1e6121d9b 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,107 +1,5 @@ == Changelog == -= 3.7.0 - 2019-08-12 = -* Enhancement - Added table ENGINE to system status report for debugging purposes. #23101 -* Enhancement - Format empty cart message as information notice. #23152 -* Enhancement - Add taxonomy-specific classes to active filters widget. #23122 -* Enhancement - Allow emails `Thanks` wording to be modified via the email settings. #22927 -* Enhancement - Move tax classes from WordPress Options to a new `wc_tax_rate_classes` table. #23093 -* Enhancement - Make WooCommerce shop roles translatable. #23150 -* Enhancement - Prevent the Cart, Checkout and My Account pages from being set to the same pages. #23479 -* Enhancement - New coupon code generate button on the coupon page. #24069 -* Enhancement - Add `tag_operator` paramater to the `[products]` shortcode for use with the `tag` paramater ie. `[products tag='tag1,tag2' tag_operator='AND']`. #24111 -* Tweak - When cleaning up variations due to product type change, force delete them instead of trashing. #23478 -* Tweak - Change wording on the link to change the address so reflect if an address is already present or not. #23532 -* Tweak - If variations are missing prices, show a notice in the product data panel. #23133 -* Tweak - Use `determine_locale()` to properly load custom translation files. #23785 -* Tweak - OBW: Switch shipping labels and shipping zones placement. #23781 -* Tweak - Show the quantity refunded on customer facing order screens. #23038 -* Tweak - CSV product import now allows true/false values for the published field, as well as the original 0 (private), -1 (draft), 1 (publish) values. #23207 -* Tweak - Update product attribute sorting tooltip to clarify usage. #23222 -* Tweak - Store tax rate percentage in the tax line items on orders. #23268 -* Tweak - Remove the left and right margin from the logo in emails. #23360 -* Tweak - Use the high res version of the WP spinner in the coupon Block UI. #23364 -* Tweak - Improve user registration validation messages. #23468 -* Tweak - Auto generate a new username when a username is blacklisted by WordPress. #23672 -* Tweak - Guest cart sessions now gets deleted when a user logs in, preventing duplicate cart sessions. #23687 -* Tweak - Include the store's base postcode and city when calculating order taxes. #23695 -* Tweak - Update the generate username setting description label to reflect how the username is actually generated. #23911 -* Tweak - OBW: Adjust plugin highlight container sizes to avoid overlap. #23997 -* Tweak - Round tax amounts late when the round at subtotal level setting is enabled to reduce rounding errors. #24024 -* Tweak - OBW: Now includes WooCommerce Admin as a recommended plugin. #24058 -* Template - Review and update all template files escaping. #23460 -* Template - Remove mention of shipping section from the checkout/form-login.php template as shipping is not always a requirement for an order. #23941 -* Template - Add new filter `woocommerce_before_thankyou` to the checkout/thankyou.php template. #23538 -* Template - Add new `woocommerce_widget_shopping_cart_total` hook to replace hardcoded subtotal in cart/mini-cart.php template. #24145 -* Template - Add new `woocommerce_widget_shopping_cart_after_buttons` hook in cart/mini-cart.php template. #24145 -* Template - Add new `woocommerce_before_cart_collaterals` hook in cart/cart.php template. #24145 -* Template - Correct the plural forms usage in loop/result-count.php template. #24005 -* Dev - Introduce new PHP 5.6 minimum requirement. #23924 -* Dev - Introduce new WordPress 4.9 minimum requirement. #24156 -* Dev - Move the settings save functionality from the `settings_page_init` function to the `wp_loaded` action so it is not saved after the settings page renders. #23091 -* Dev - Add quantity input action hooks `woocommerce_before_add_to_cart_quantity` and `woocommerce_after_add_to_cart_quantity`. #23166 -* Dev - Add `$this` parameter to email class filters. #23250 -* Dev - Add new `WC_Abstract_Order::get_coupons()` method for returning all coupon line item objects on an order. #23663 -* Dev - Added new action `woocommerce_product_read` to `WC_Product_Data_Store_CPT::read()`. #23181 -* Dev - Add new filter `woocommerce_admin_order_buyer_name` to the `WC_Admin_List_Table_Orders::render_order_number_column()` method to change the buyer name in orders list screen. #23741 -* Dev - Add new actions to `WC_Helper` class for when WooCommerce.com Product Subscription statuses change `woocommerce_helper_subscription_activate_success`, `woocommerce_helper_subscription_activate_error`, `woocommerce_helper_subscription_deactivate_success`, and `woocommerce_helper_subscription_deactivate_error`. #23041 -* Dev - Extend usage and event tracking (if opted in) to system status, admin order and admin coupon pages. #23190 #23189 #23883 -* Dev - Add `woocommerce_after_X_object_save` actions, and passed objects to `woocommerce_new_x` and `woocommerce_update_x` actions. #23338 -* Dev - Update customer order and lifetime spend totals in `wc_update_new_customer_past_orders()` to trigger `customer.updated` webhooks for paid orders. #23402 -* Dev - Preserve the State field's custom css classes when selecting an option from the Country dropdown. #23433 -* Dev - Add new `woocommerce_product_related_posts_shuffle` filter in `wc_get_related_products()` to enable/disable related product shuffling, defaults to true. #23562 -* Dev - Deprecate the `WC_Abstract_Order::get_used_coupons()` method and replace it with a new method `WC_Abstract_Order::get_coupon_codes()`. #23689 -* Dev - Add new `woocommerce_prices_include_tax` filter in the `wc_prices_include_tax()` function. #23697 -* Dev - Add new `woocommerce_admin_after_product_gallery_item` filter in the `WC_Meta_Box_Product_Images::output()` method for adding additional markup after product gallery items. #23743 -* Dev - Remove unused images `assets/images/klarna-white.png` and `assets/images/square-white.png`. #23748 -* Dev - Move Free Shipping method JavaScript code from outputting on all shipping setting pages to just the Free Shipping page using the `admin_footer` hook. #23776 -* Dev - Prevent PHP fatal error while throwing exceptions in `woocommerce_rest_insert_{post_type}_object` hooks. #23793 -* Dev - Add new `woocommerce_enforce_password_strength_meter_on_checkout` filter in the `WC_Frontend_Scripts::get_script_data()` method to allow enforcing the password strength meter on checkout. #23811 -* Dev - Add new `woocommerce_search_products_post_statuses` filter in the `WC_Product_Data_Store_CPT::search_products()` method for controlling what post statuses to include in product searches. #23838 -* Dev - Allow filtering `woocommerce_order_formatted_shipping_address` even when no shipping address is defined. #23859 -* Dev - Change the query in the `WC_Product_Data_Store::find_matching_product_variation()` method to always respect the ordering of variations. #23881 -* Dev - Move all feature plugin features out from the WooCommerce codebase and utilize composer and an autoloader for including it in WooCommerce core, affects WC REST API and WC Blocks. #23957 -* Dev - Allow displaying multiple error messages through the registration validation. #23968 -* Dev - Add new `woocommerce_cart_item_removed_notice_type`, `woocommerce_cart_updated_notice_type` and `woocommerce_add_to_cart_notice_type` filters for changing the default notice types for cart notices. #24021 -* Dev - Add namespaced support for Jetpack 7.5 tracking library. #24140 -* Dev - Add support for an improved WooCommerce.com Marketplace browse and purchase experience (in progress). #24075 #24123 -* Dev - Added `$order` and `$product` as parameters to the `woocommerce_ajax_order_item` filter in `WC_Ajax::add_order_item()`. #24108 -* Dev - Add new `woocommerce_product_import_image_separator` filter in `WC_Product_CSV_Importer::parse_images_field()` for adjusting the product images seperator. #24120 -* Dev - Add new `woocommerce_widget_shopping_cart_subtotal()` template function that hooks into the `woocommerce_widget_shopping_cart_total` action to output the mini cart subtotal. #24145 -* Dev - Deprecate the `woocommerce_before_cart_item_quantity_zero` action from `WC_Cart::restore_cart_item()` in favor of existing `woocommerce_cart_item_removed` action. #23112 -* Dev - Deprecate WC_Tax::maybe_remove_tax_class_rates which hooked into the WP Options update hook for taxes in favor of new function WC_Tax::delete_tax_class_by which works on the new tax classes table. #24213 -* Fix - Use version_compare for determining the maximum WooCommerce database version number. #23092 -* Fix - Missing space and closing `` tag in WooCommerce.com disconnect message. #24073 -* Fix - CSV Importer - Skip rows during update if a SKU column exists, but the value is empty. #23262 -* Fix - Allow matching `Any` attributes when calling `WC_Product_Data_Store::find_matching_product_variation()`. #23067 -* Fix - Switch coupon amount validation based on decimal seperator setting. #23137 -* Fix - Show the correct results for shortcodes on static homepages when sorting. #23159 -* Fix - Queue AJAX add to cart events to avoid overwriting session data. #23293 -* Fix - Wrong subtotals when changing tax classes via the `woocommerce_product_get_tax_class` filter. #23344 -* Fix - Fatal error on plain text order emails where products were deleted. #23754 -* Fix - Do not pass the `no_shipping` argument to PayPal when the order contains shippable items. #23773 -* Fix - Product review form does respects the `require_name_email` WordPress core option. #23786 -* Fix - Do not cache expired sessions, negative expiry causes errors in some caching modules. #23863 -* Fix - WC_Log_Handler_DB logs now uses the same timestamp format as text logs, Y-m-d H:i:s. #23863 -* Fix - Display line breaks for customer notes in emails, and order details. #23969 -* Fix - Correct plural forms usage in `WC_Admin_Report` class. #24020 -* Fix - System status database info section throwing a PHP notice on some DB environments. #24023 -* Fix - On the system status database info section display a message informing users that WooCommerce was unable to get database information instead of an error, when a database sharding plugin is active. #24034 -* Fix - Usage and event tracking (if opted in) was not working correctly in the OBW. #24056 -* Fix - Fatal error on downloads report when some download files were missing. #24118 -* Fix - Prevents the taxes columns from being removed when the order is no longer editable in admin. #23884 -* Performance - Improve the speed of the admin dashboard by only updating transients once per class. #23011 -* Performance - Reduce number of queries needed to populate variations data by priming post caches. #23272 -* Performance - Persistant cart improvements, only update the persistent cart if the cart items actually change. #23112 -* Performance - Exclude `action_log` comment types from `wp_count_comments`. #24071 -* Localization - Added validation for Italian postcodes. #23269 -* Localization - Remove unused tax locale defaults since we now promote auto tax services instead. #23431 -* Localization - Define correct address format for Uganda. #23178 -* Localization - Hide the postcode and update the state label to "Province" for Mozambique. #23764 -* Localization - OBW: Make postal code optional based on locale data. #23915 -* Localization - Add new currency for São Tomé, Príncipe dobra and Mauritanian ouguiya. #23950 -* Localization - Change Canada poscode label to `Postal code`. #23740 - = 3.6.5 - 2019-07-02 = * Security - Introduce file type check for tax rate importer. * Security - Added nonce check to CSV importer actions. diff --git a/readme.txt b/readme.txt index dc065e0c4f4..cb422736aa4 100644 --- a/readme.txt +++ b/readme.txt @@ -181,6 +181,108 @@ INTERESTED IN DEVELOPMENT? = 3.8.0 - 2019-11-08 = += 3.7.0 - 2019-08-12 = +* Enhancement - Added table ENGINE to system status report for debugging purposes. #23101 +* Enhancement - Format empty cart message as information notice. #23152 +* Enhancement - Add taxonomy-specific classes to active filters widget. #23122 +* Enhancement - Allow emails `Thanks` wording to be modified via the email settings. #22927 +* Enhancement - Move tax classes from WordPress Options to a new `wc_tax_rate_classes` table. #23093 +* Enhancement - Make WooCommerce shop roles translatable. #23150 +* Enhancement - Prevent the Cart, Checkout and My Account pages from being set to the same pages. #23479 +* Enhancement - New coupon code generate button on the coupon page. #24069 +* Enhancement - Add `tag_operator` paramater to the `[products]` shortcode for use with the `tag` paramater ie. `[products tag='tag1,tag2' tag_operator='AND']`. #24111 +* Tweak - When cleaning up variations due to product type change, force delete them instead of trashing. #23478 +* Tweak - Change wording on the link to change the address so reflect if an address is already present or not. #23532 +* Tweak - If variations are missing prices, show a notice in the product data panel. #23133 +* Tweak - Use `determine_locale()` to properly load custom translation files. #23785 +* Tweak - OBW: Switch shipping labels and shipping zones placement. #23781 +* Tweak - Show the quantity refunded on customer facing order screens. #23038 +* Tweak - CSV product import now allows true/false values for the published field, as well as the original 0 (private), -1 (draft), 1 (publish) values. #23207 +* Tweak - Update product attribute sorting tooltip to clarify usage. #23222 +* Tweak - Store tax rate percentage in the tax line items on orders. #23268 +* Tweak - Remove the left and right margin from the logo in emails. #23360 +* Tweak - Use the high res version of the WP spinner in the coupon Block UI. #23364 +* Tweak - Improve user registration validation messages. #23468 +* Tweak - Auto generate a new username when a username is blacklisted by WordPress. #23672 +* Tweak - Guest cart sessions now gets deleted when a user logs in, preventing duplicate cart sessions. #23687 +* Tweak - Include the store's base postcode and city when calculating order taxes. #23695 +* Tweak - Update the generate username setting description label to reflect how the username is actually generated. #23911 +* Tweak - OBW: Adjust plugin highlight container sizes to avoid overlap. #23997 +* Tweak - Round tax amounts late when the round at subtotal level setting is enabled to reduce rounding errors. #24024 +* Tweak - OBW: Now includes WooCommerce Admin as a recommended plugin. #24058 +* Template - Review and update all template files escaping. #23460 +* Template - Remove mention of shipping section from the checkout/form-login.php template as shipping is not always a requirement for an order. #23941 +* Template - Add new filter `woocommerce_before_thankyou` to the checkout/thankyou.php template. #23538 +* Template - Add new `woocommerce_widget_shopping_cart_total` hook to replace hardcoded subtotal in cart/mini-cart.php template. #24145 +* Template - Add new `woocommerce_widget_shopping_cart_after_buttons` hook in cart/mini-cart.php template. #24145 +* Template - Add new `woocommerce_before_cart_collaterals` hook in cart/cart.php template. #24145 +* Template - Correct the plural forms usage in loop/result-count.php template. #24005 +* Dev - Introduce new PHP 5.6 minimum requirement. #23924 +* Dev - Introduce new WordPress 4.9 minimum requirement. #24156 +* Dev - Move the settings save functionality from the `settings_page_init` function to the `wp_loaded` action so it is not saved after the settings page renders. #23091 +* Dev - Add quantity input action hooks `woocommerce_before_add_to_cart_quantity` and `woocommerce_after_add_to_cart_quantity`. #23166 +* Dev - Add `$this` parameter to email class filters. #23250 +* Dev - Add new `WC_Abstract_Order::get_coupons()` method for returning all coupon line item objects on an order. #23663 +* Dev - Added new action `woocommerce_product_read` to `WC_Product_Data_Store_CPT::read()`. #23181 +* Dev - Add new filter `woocommerce_admin_order_buyer_name` to the `WC_Admin_List_Table_Orders::render_order_number_column()` method to change the buyer name in orders list screen. #23741 +* Dev - Add new actions to `WC_Helper` class for when WooCommerce.com Product Subscription statuses change `woocommerce_helper_subscription_activate_success`, `woocommerce_helper_subscription_activate_error`, `woocommerce_helper_subscription_deactivate_success`, and `woocommerce_helper_subscription_deactivate_error`. #23041 +* Dev - Extend usage and event tracking (if opted in) to system status, admin order and admin coupon pages. #23190 #23189 #23883 +* Dev - Add `woocommerce_after_X_object_save` actions, and passed objects to `woocommerce_new_x` and `woocommerce_update_x` actions. #23338 +* Dev - Update customer order and lifetime spend totals in `wc_update_new_customer_past_orders()` to trigger `customer.updated` webhooks for paid orders. #23402 +* Dev - Preserve the State field's custom css classes when selecting an option from the Country dropdown. #23433 +* Dev - Add new `woocommerce_product_related_posts_shuffle` filter in `wc_get_related_products()` to enable/disable related product shuffling, defaults to true. #23562 +* Dev - Deprecate the `WC_Abstract_Order::get_used_coupons()` method and replace it with a new method `WC_Abstract_Order::get_coupon_codes()`. #23689 +* Dev - Add new `woocommerce_prices_include_tax` filter in the `wc_prices_include_tax()` function. #23697 +* Dev - Add new `woocommerce_admin_after_product_gallery_item` filter in the `WC_Meta_Box_Product_Images::output()` method for adding additional markup after product gallery items. #23743 +* Dev - Remove unused images `assets/images/klarna-white.png` and `assets/images/square-white.png`. #23748 +* Dev - Move Free Shipping method JavaScript code from outputting on all shipping setting pages to just the Free Shipping page using the `admin_footer` hook. #23776 +* Dev - Prevent PHP fatal error while throwing exceptions in `woocommerce_rest_insert_{post_type}_object` hooks. #23793 +* Dev - Add new `woocommerce_enforce_password_strength_meter_on_checkout` filter in the `WC_Frontend_Scripts::get_script_data()` method to allow enforcing the password strength meter on checkout. #23811 +* Dev - Add new `woocommerce_search_products_post_statuses` filter in the `WC_Product_Data_Store_CPT::search_products()` method for controlling what post statuses to include in product searches. #23838 +* Dev - Allow filtering `woocommerce_order_formatted_shipping_address` even when no shipping address is defined. #23859 +* Dev - Change the query in the `WC_Product_Data_Store::find_matching_product_variation()` method to always respect the ordering of variations. #23881 +* Dev - Move all feature plugin features out from the WooCommerce codebase and utilize composer and an autoloader for including it in WooCommerce core, affects WC REST API and WC Blocks. #23957 +* Dev - Allow displaying multiple error messages through the registration validation. #23968 +* Dev - Add new `woocommerce_cart_item_removed_notice_type`, `woocommerce_cart_updated_notice_type` and `woocommerce_add_to_cart_notice_type` filters for changing the default notice types for cart notices. #24021 +* Dev - Add namespaced support for Jetpack 7.5 tracking library. #24140 +* Dev - Add support for an improved WooCommerce.com Marketplace browse and purchase experience (in progress). #24075 #24123 +* Dev - Added `$order` and `$product` as parameters to the `woocommerce_ajax_order_item` filter in `WC_Ajax::add_order_item()`. #24108 +* Dev - Add new `woocommerce_product_import_image_separator` filter in `WC_Product_CSV_Importer::parse_images_field()` for adjusting the product images seperator. #24120 +* Dev - Add new `woocommerce_widget_shopping_cart_subtotal()` template function that hooks into the `woocommerce_widget_shopping_cart_total` action to output the mini cart subtotal. #24145 +* Dev - Deprecate the `woocommerce_before_cart_item_quantity_zero` action from `WC_Cart::restore_cart_item()` in favor of existing `woocommerce_cart_item_removed` action. #23112 +* Dev - Deprecate WC_Tax::maybe_remove_tax_class_rates which hooked into the WP Options update hook for taxes in favor of new function WC_Tax::delete_tax_class_by which works on the new tax classes table. #24213 +* Fix - Use version_compare for determining the maximum WooCommerce database version number. #23092 +* Fix - Missing space and closing `` tag in WooCommerce.com disconnect message. #24073 +* Fix - CSV Importer - Skip rows during update if a SKU column exists, but the value is empty. #23262 +* Fix - Allow matching `Any` attributes when calling `WC_Product_Data_Store::find_matching_product_variation()`. #23067 +* Fix - Switch coupon amount validation based on decimal seperator setting. #23137 +* Fix - Show the correct results for shortcodes on static homepages when sorting. #23159 +* Fix - Queue AJAX add to cart events to avoid overwriting session data. #23293 +* Fix - Wrong subtotals when changing tax classes via the `woocommerce_product_get_tax_class` filter. #23344 +* Fix - Fatal error on plain text order emails where products were deleted. #23754 +* Fix - Do not pass the `no_shipping` argument to PayPal when the order contains shippable items. #23773 +* Fix - Product review form does respects the `require_name_email` WordPress core option. #23786 +* Fix - Do not cache expired sessions, negative expiry causes errors in some caching modules. #23863 +* Fix - WC_Log_Handler_DB logs now uses the same timestamp format as text logs, Y-m-d H:i:s. #23863 +* Fix - Display line breaks for customer notes in emails, and order details. #23969 +* Fix - Correct plural forms usage in `WC_Admin_Report` class. #24020 +* Fix - System status database info section throwing a PHP notice on some DB environments. #24023 +* Fix - On the system status database info section display a message informing users that WooCommerce was unable to get database information instead of an error, when a database sharding plugin is active. #24034 +* Fix - Usage and event tracking (if opted in) was not working correctly in the OBW. #24056 +* Fix - Fatal error on downloads report when some download files were missing. #24118 +* Fix - Prevents the taxes columns from being removed when the order is no longer editable in admin. #23884 +* Performance - Improve the speed of the admin dashboard by only updating transients once per class. #23011 +* Performance - Reduce number of queries needed to populate variations data by priming post caches. #23272 +* Performance - Persistant cart improvements, only update the persistent cart if the cart items actually change. #23112 +* Performance - Exclude `action_log` comment types from `wp_count_comments`. #24071 +* Localization - Added validation for Italian postcodes. #23269 +* Localization - Remove unused tax locale defaults since we now promote auto tax services instead. #23431 +* Localization - Define correct address format for Uganda. #23178 +* Localization - Hide the postcode and update the state label to "Province" for Mozambique. #23764 +* Localization - OBW: Make postal code optional based on locale data. #23915 +* Localization - Add new currency for São Tomé, Príncipe dobra and Mauritanian ouguiya. #23950 +* Localization - Change Canada poscode label to `Postal code`. #23740 + [See changelog for all versions](https://raw.githubusercontent.com/woocommerce/woocommerce/master/CHANGELOG.txt). From 27689ba0ca687229603b4d455cc51a6344b56cd0 Mon Sep 17 00:00:00 2001 From: Hardik Thakkar Date: Thu, 27 Jun 2019 18:40:32 +0530 Subject: [PATCH 075/361] Fixed #23870 --- assets/js/admin/meta-boxes-order.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/assets/js/admin/meta-boxes-order.js b/assets/js/admin/meta-boxes-order.js index 298a7468569..a7341c32680 100644 --- a/assets/js/admin/meta-boxes-order.js +++ b/assets/js/admin/meta-boxes-order.js @@ -43,10 +43,11 @@ jQuery( function ( $ ) { var $this = $( this ), country = $this.val(), $state = $this.parents( 'div.edit_address' ).find( ':input.js_field-state' ), + $stateValue = $state.val(), $parent = $state.parent(), input_name = $state.attr( 'name' ), input_id = $state.attr( 'id' ), - value = $this.data( 'woocommerce.stickState-' + country ) ? $this.data( 'woocommerce.stickState-' + country ) : $state.val(), + value = $this.data( 'woocommerce.stickState-' + country ) ? $this.data( 'woocommerce.stickState-' + country ) : $stateValue, placeholder = $state.attr( 'placeholder' ), $newstate; @@ -87,7 +88,7 @@ jQuery( function ( $ ) { .prop( 'name', input_name ) .prop( 'placeholder', placeholder ) .addClass( 'js_field-state' ) - .val( '' ); + .val( $stateValue ); $state.replaceWith( $newstate ); } From 34e883ce81bc0fd4ade3cbf9a347c39640af084e Mon Sep 17 00:00:00 2001 From: Gerhard Date: Fri, 2 Aug 2019 14:19:37 +0200 Subject: [PATCH 076/361] Apply patch by @dtwist --- assets/js/admin/meta-boxes-order.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/assets/js/admin/meta-boxes-order.js b/assets/js/admin/meta-boxes-order.js index a7341c32680..6859786c31f 100644 --- a/assets/js/admin/meta-boxes-order.js +++ b/assets/js/admin/meta-boxes-order.js @@ -43,11 +43,11 @@ jQuery( function ( $ ) { var $this = $( this ), country = $this.val(), $state = $this.parents( 'div.edit_address' ).find( ':input.js_field-state' ), - $stateValue = $state.val(), $parent = $state.parent(), + stateValue = $state.val(), input_name = $state.attr( 'name' ), input_id = $state.attr( 'id' ), - value = $this.data( 'woocommerce.stickState-' + country ) ? $this.data( 'woocommerce.stickState-' + country ) : $stateValue, + value = $this.data( 'woocommerce.stickState-' + country ) ? $this.data( 'woocommerce.stickState-' + country ) : stateValue, placeholder = $state.attr( 'placeholder' ), $newstate; @@ -74,6 +74,9 @@ jQuery( function ( $ ) { var $option = $( '' ) .prop( 'value', index ) .text( state[ index ] ); + if ( index == stateValue ) { + $option.prop( 'selected' ); + } $newstate.append( $option ); } ); @@ -88,7 +91,7 @@ jQuery( function ( $ ) { .prop( 'name', input_name ) .prop( 'placeholder', placeholder ) .addClass( 'js_field-state' ) - .val( $stateValue ); + .val( stateValue ); $state.replaceWith( $newstate ); } From 02f9c7c8ff8e1a695fd5c26d4a44a2382db967d8 Mon Sep 17 00:00:00 2001 From: Gerhard Date: Fri, 2 Aug 2019 14:55:17 +0200 Subject: [PATCH 077/361] Use strict checking --- assets/js/admin/meta-boxes-order.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/js/admin/meta-boxes-order.js b/assets/js/admin/meta-boxes-order.js index 6859786c31f..9c243d0a810 100644 --- a/assets/js/admin/meta-boxes-order.js +++ b/assets/js/admin/meta-boxes-order.js @@ -74,7 +74,7 @@ jQuery( function ( $ ) { var $option = $( '' ) .prop( 'value', index ) .text( state[ index ] ); - if ( index == stateValue ) { + if ( index === stateValue ) { $option.prop( 'selected' ); } $newstate.append( $option ); From 646c661f4ffdf6cd0e08cb42a4ecbafe26e68182 Mon Sep 17 00:00:00 2001 From: Gerhard Date: Fri, 2 Aug 2019 15:03:41 +0200 Subject: [PATCH 078/361] Changelog for #24301 --- readme.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.txt b/readme.txt index cb422736aa4..796694bb1fb 100644 --- a/readme.txt +++ b/readme.txt @@ -271,6 +271,7 @@ INTERESTED IN DEVELOPMENT? * Fix - Usage and event tracking (if opted in) was not working correctly in the OBW. #24056 * Fix - Fatal error on downloads report when some download files were missing. #24118 * Fix - Prevents the taxes columns from being removed when the order is no longer editable in admin. #23884 +* Fix - State field overwritten with blank value when saving orders via wp-admin. #24301 * Performance - Improve the speed of the admin dashboard by only updating transients once per class. #23011 * Performance - Reduce number of queries needed to populate variations data by priming post caches. #23272 * Performance - Persistant cart improvements, only update the persistent cart if the cart items actually change. #23112 From 3a435ef9e4f02f5bace37ee8efd6f0cf270d5bd3 Mon Sep 17 00:00:00 2001 From: Luis Date: Fri, 2 Aug 2019 11:19:43 -0300 Subject: [PATCH 079/361] Changing filter names and bumping version --- templates/content-widget-price-filter.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/content-widget-price-filter.php b/templates/content-widget-price-filter.php index a71ecdcd692..f9333f23031 100644 --- a/templates/content-widget-price-filter.php +++ b/templates/content-widget-price-filter.php @@ -12,13 +12,13 @@ * * @see https://docs.woocommerce.com/document/template-structure/ * @package WooCommerce/Templates - * @version 3.6.1 + * @version 3.7.1 */ defined( 'ABSPATH' ) || exit; ?> - +
@@ -36,4 +36,4 @@ defined( 'ABSPATH' ) || exit;
- + From 802002a10aa4691c1f98b24b69c4311aa049dd4a Mon Sep 17 00:00:00 2001 From: Luis Date: Fri, 2 Aug 2019 11:31:11 -0300 Subject: [PATCH 080/361] Adding the "translators" comment. --- templates/content-widget-price-filter.php | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/content-widget-price-filter.php b/templates/content-widget-price-filter.php index f9333f23031..d7bb4148c18 100644 --- a/templates/content-widget-price-filter.php +++ b/templates/content-widget-price-filter.php @@ -26,6 +26,7 @@ defined( 'ABSPATH' ) || exit;
+