From fa4e55bca38bd839f59b6a1bc1cf03d4ac367ad8 Mon Sep 17 00:00:00 2001 From: Shamali Sulakhe Date: Thu, 17 Oct 2019 19:14:37 +0530 Subject: [PATCH 001/100] Showed filename when product CSV import is finished - issue #24266 --- assets/js/admin/wc-product-import.js | 3 ++- .../class-wc-product-csv-importer-controller.php | 11 ++++++----- .../admin/importers/views/html-csv-import-done.php | 8 ++++++++ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/assets/js/admin/wc-product-import.js b/assets/js/admin/wc-product-import.js index 0af872bcd8a..967d84f6ef5 100644 --- a/assets/js/admin/wc-product-import.js +++ b/assets/js/admin/wc-product-import.js @@ -58,7 +58,8 @@ $this.$form.find('.woocommerce-importer-progress').val( response.data.percentage ); if ( 'done' === response.data.position ) { - window.location = response.data.url + '&products-imported=' + parseInt( $this.imported, 10 ) + '&products-failed=' + parseInt( $this.failed, 10 ) + '&products-updated=' + parseInt( $this.updated, 10 ) + '&products-skipped=' + parseInt( $this.skipped, 10 ); + var file_name = wc_product_import_params.file.split('/').pop(); + window.location = response.data.url + '&products-imported=' + parseInt( $this.imported, 10 ) + '&products-failed=' + parseInt( $this.failed, 10 ) + '&products-updated=' + parseInt( $this.updated, 10 ) + '&products-skipped=' + parseInt( $this.skipped, 10 )+'&file-name='+file_name; } else { $this.run_import(); } diff --git a/includes/admin/importers/class-wc-product-csv-importer-controller.php b/includes/admin/importers/class-wc-product-csv-importer-controller.php index fbd20e779d6..104115b7387 100644 --- a/includes/admin/importers/class-wc-product-csv-importer-controller.php +++ b/includes/admin/importers/class-wc-product-csv-importer-controller.php @@ -455,11 +455,12 @@ class WC_Product_CSV_Importer_Controller { */ protected function done() { check_admin_referer( 'woocommerce-csv-importer' ); - $imported = isset( $_GET['products-imported'] ) ? absint( $_GET['products-imported'] ) : 0; - $updated = isset( $_GET['products-updated'] ) ? absint( $_GET['products-updated'] ) : 0; - $failed = isset( $_GET['products-failed'] ) ? absint( $_GET['products-failed'] ) : 0; - $skipped = isset( $_GET['products-skipped'] ) ? absint( $_GET['products-skipped'] ) : 0; - $errors = array_filter( (array) get_user_option( 'product_import_error_log' ) ); + $imported = isset( $_GET['products-imported'] ) ? absint( $_GET['products-imported'] ) : 0; + $updated = isset( $_GET['products-updated'] ) ? absint( $_GET['products-updated'] ) : 0; + $failed = isset( $_GET['products-failed'] ) ? absint( $_GET['products-failed'] ) : 0; + $skipped = isset( $_GET['products-skipped'] ) ? absint( $_GET['products-skipped'] ) : 0; + $file_name = isset( $_GET['file-name'] ) ? sanitize_text_field( wp_unslash( $_GET['file-name'] ) ) : ''; + $errors = array_filter( (array) get_user_option( 'product_import_error_log' ) ); include_once dirname( __FILE__ ) . '/views/html-csv-import-done.php'; } diff --git a/includes/admin/importers/views/html-csv-import-done.php b/includes/admin/importers/views/html-csv-import-done.php index 3f43869edb8..1774001d014 100644 --- a/includes/admin/importers/views/html-csv-import-done.php +++ b/includes/admin/importers/views/html-csv-import-done.php @@ -50,6 +50,14 @@ if ( ! defined( 'ABSPATH' ) ) { $results[] = '' . __( 'View import log', 'woocommerce' ) . ''; } + if ( ! empty( $file_name ) ) { + $results[] = sprintf( + /* translators: %s: File name */ + __( 'File uploaded: %s', 'woocommerce' ), + '' . $file_name . '' + ); + } + /* translators: %d: import results */ echo wp_kses_post( __( 'Import complete!', 'woocommerce' ) . ' ' . implode( '. ', $results ) ); ?> From 1b7d89dec6cffebfbae0399f6c4f725ec7f3057d Mon Sep 17 00:00:00 2001 From: Shamali Sulakhe Date: Thu, 17 Oct 2019 19:24:32 +0530 Subject: [PATCH 002/100] Added patch for issue #24266 --- 24266.diff | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 24266.diff diff --git a/24266.diff b/24266.diff new file mode 100644 index 00000000000..3076924728a --- /dev/null +++ b/24266.diff @@ -0,0 +1,55 @@ +diff --git a/assets/js/admin/wc-product-import.js b/assets/js/admin/wc-product-import.js +index 0af872b..967d84f 100644 +--- a/assets/js/admin/wc-product-import.js ++++ b/assets/js/admin/wc-product-import.js +@@ -58,7 +58,8 @@ + $this.$form.find('.woocommerce-importer-progress').val( response.data.percentage ); + + if ( 'done' === response.data.position ) { +- window.location = response.data.url + '&products-imported=' + parseInt( $this.imported, 10 ) + '&products-failed=' + parseInt( $this.failed, 10 ) + '&products-updated=' + parseInt( $this.updated, 10 ) + '&products-skipped=' + parseInt( $this.skipped, 10 ); ++ var file_name = wc_product_import_params.file.split('/').pop(); ++ window.location = response.data.url + '&products-imported=' + parseInt( $this.imported, 10 ) + '&products-failed=' + parseInt( $this.failed, 10 ) + '&products-updated=' + parseInt( $this.updated, 10 ) + '&products-skipped=' + parseInt( $this.skipped, 10 )+'&file-name='+file_name; + } else { + $this.run_import(); + } +diff --git a/includes/admin/importers/class-wc-product-csv-importer-controller.php b/includes/admin/importers/class-wc-product-csv-importer-controller.php +index fbd20e7..104115b 100644 +--- a/includes/admin/importers/class-wc-product-csv-importer-controller.php ++++ b/includes/admin/importers/class-wc-product-csv-importer-controller.php +@@ -455,11 +455,12 @@ class WC_Product_CSV_Importer_Controller { + */ + protected function done() { + check_admin_referer( 'woocommerce-csv-importer' ); +- $imported = isset( $_GET['products-imported'] ) ? absint( $_GET['products-imported'] ) : 0; +- $updated = isset( $_GET['products-updated'] ) ? absint( $_GET['products-updated'] ) : 0; +- $failed = isset( $_GET['products-failed'] ) ? absint( $_GET['products-failed'] ) : 0; +- $skipped = isset( $_GET['products-skipped'] ) ? absint( $_GET['products-skipped'] ) : 0; +- $errors = array_filter( (array) get_user_option( 'product_import_error_log' ) ); ++ $imported = isset( $_GET['products-imported'] ) ? absint( $_GET['products-imported'] ) : 0; ++ $updated = isset( $_GET['products-updated'] ) ? absint( $_GET['products-updated'] ) : 0; ++ $failed = isset( $_GET['products-failed'] ) ? absint( $_GET['products-failed'] ) : 0; ++ $skipped = isset( $_GET['products-skipped'] ) ? absint( $_GET['products-skipped'] ) : 0; ++ $file_name = isset( $_GET['file-name'] ) ? sanitize_text_field( wp_unslash( $_GET['file-name'] ) ) : ''; ++ $errors = array_filter( (array) get_user_option( 'product_import_error_log' ) ); + + include_once dirname( __FILE__ ) . '/views/html-csv-import-done.php'; + } +diff --git a/includes/admin/importers/views/html-csv-import-done.php b/includes/admin/importers/views/html-csv-import-done.php +index 3f43869..1774001 100644 +--- a/includes/admin/importers/views/html-csv-import-done.php ++++ b/includes/admin/importers/views/html-csv-import-done.php +@@ -50,6 +50,14 @@ if ( ! defined( 'ABSPATH' ) ) { + $results[] = '' . __( 'View import log', 'woocommerce' ) . ''; + } + ++ if ( ! empty( $file_name ) ) { ++ $results[] = sprintf( ++ /* translators: %s: File name */ ++ __( 'File uploaded: %s', 'woocommerce' ), ++ '' . $file_name . '' ++ ); ++ } ++ + /* translators: %d: import results */ + echo wp_kses_post( __( 'Import complete!', 'woocommerce' ) . ' ' . implode( '. ', $results ) ); + ?> From 64fbb197d70e152a2ed28cc66379e0fc6ca70e13 Mon Sep 17 00:00:00 2001 From: Shamali Sulakhe Date: Fri, 15 Nov 2019 17:58:05 +0530 Subject: [PATCH 003/100] Removed patch file and merged changed with ver 3.9.0-dev --- assets/js/admin/wc-product-import.js | 3 ++- .../class-wc-product-csv-importer-controller.php | 11 ++++++----- .../admin/importers/views/html-csv-import-done.php | 8 ++++++++ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/assets/js/admin/wc-product-import.js b/assets/js/admin/wc-product-import.js index 0af872bcd8a..967d84f6ef5 100644 --- a/assets/js/admin/wc-product-import.js +++ b/assets/js/admin/wc-product-import.js @@ -58,7 +58,8 @@ $this.$form.find('.woocommerce-importer-progress').val( response.data.percentage ); if ( 'done' === response.data.position ) { - window.location = response.data.url + '&products-imported=' + parseInt( $this.imported, 10 ) + '&products-failed=' + parseInt( $this.failed, 10 ) + '&products-updated=' + parseInt( $this.updated, 10 ) + '&products-skipped=' + parseInt( $this.skipped, 10 ); + var file_name = wc_product_import_params.file.split('/').pop(); + window.location = response.data.url + '&products-imported=' + parseInt( $this.imported, 10 ) + '&products-failed=' + parseInt( $this.failed, 10 ) + '&products-updated=' + parseInt( $this.updated, 10 ) + '&products-skipped=' + parseInt( $this.skipped, 10 )+'&file-name='+file_name; } else { $this.run_import(); } diff --git a/includes/admin/importers/class-wc-product-csv-importer-controller.php b/includes/admin/importers/class-wc-product-csv-importer-controller.php index fbd20e779d6..104115b7387 100644 --- a/includes/admin/importers/class-wc-product-csv-importer-controller.php +++ b/includes/admin/importers/class-wc-product-csv-importer-controller.php @@ -455,11 +455,12 @@ class WC_Product_CSV_Importer_Controller { */ protected function done() { check_admin_referer( 'woocommerce-csv-importer' ); - $imported = isset( $_GET['products-imported'] ) ? absint( $_GET['products-imported'] ) : 0; - $updated = isset( $_GET['products-updated'] ) ? absint( $_GET['products-updated'] ) : 0; - $failed = isset( $_GET['products-failed'] ) ? absint( $_GET['products-failed'] ) : 0; - $skipped = isset( $_GET['products-skipped'] ) ? absint( $_GET['products-skipped'] ) : 0; - $errors = array_filter( (array) get_user_option( 'product_import_error_log' ) ); + $imported = isset( $_GET['products-imported'] ) ? absint( $_GET['products-imported'] ) : 0; + $updated = isset( $_GET['products-updated'] ) ? absint( $_GET['products-updated'] ) : 0; + $failed = isset( $_GET['products-failed'] ) ? absint( $_GET['products-failed'] ) : 0; + $skipped = isset( $_GET['products-skipped'] ) ? absint( $_GET['products-skipped'] ) : 0; + $file_name = isset( $_GET['file-name'] ) ? sanitize_text_field( wp_unslash( $_GET['file-name'] ) ) : ''; + $errors = array_filter( (array) get_user_option( 'product_import_error_log' ) ); include_once dirname( __FILE__ ) . '/views/html-csv-import-done.php'; } diff --git a/includes/admin/importers/views/html-csv-import-done.php b/includes/admin/importers/views/html-csv-import-done.php index 3f43869edb8..1774001d014 100644 --- a/includes/admin/importers/views/html-csv-import-done.php +++ b/includes/admin/importers/views/html-csv-import-done.php @@ -50,6 +50,14 @@ if ( ! defined( 'ABSPATH' ) ) { $results[] = '' . __( 'View import log', 'woocommerce' ) . ''; } + if ( ! empty( $file_name ) ) { + $results[] = sprintf( + /* translators: %s: File name */ + __( 'File uploaded: %s', 'woocommerce' ), + '' . $file_name . '' + ); + } + /* translators: %d: import results */ echo wp_kses_post( __( 'Import complete!', 'woocommerce' ) . ' ' . implode( '. ', $results ) ); ?> From 04719b65011368a22412816dfff559eee7b9ebe2 Mon Sep 17 00:00:00 2001 From: Shamali Sulakhe Date: Fri, 15 Nov 2019 18:09:19 +0530 Subject: [PATCH 004/100] Removed patch file and added changes to version 3.9.0-dev --- 24266.diff | 55 ------------------------------------------------------ 1 file changed, 55 deletions(-) delete mode 100644 24266.diff diff --git a/24266.diff b/24266.diff deleted file mode 100644 index 3076924728a..00000000000 --- a/24266.diff +++ /dev/null @@ -1,55 +0,0 @@ -diff --git a/assets/js/admin/wc-product-import.js b/assets/js/admin/wc-product-import.js -index 0af872b..967d84f 100644 ---- a/assets/js/admin/wc-product-import.js -+++ b/assets/js/admin/wc-product-import.js -@@ -58,7 +58,8 @@ - $this.$form.find('.woocommerce-importer-progress').val( response.data.percentage ); - - if ( 'done' === response.data.position ) { -- window.location = response.data.url + '&products-imported=' + parseInt( $this.imported, 10 ) + '&products-failed=' + parseInt( $this.failed, 10 ) + '&products-updated=' + parseInt( $this.updated, 10 ) + '&products-skipped=' + parseInt( $this.skipped, 10 ); -+ var file_name = wc_product_import_params.file.split('/').pop(); -+ window.location = response.data.url + '&products-imported=' + parseInt( $this.imported, 10 ) + '&products-failed=' + parseInt( $this.failed, 10 ) + '&products-updated=' + parseInt( $this.updated, 10 ) + '&products-skipped=' + parseInt( $this.skipped, 10 )+'&file-name='+file_name; - } else { - $this.run_import(); - } -diff --git a/includes/admin/importers/class-wc-product-csv-importer-controller.php b/includes/admin/importers/class-wc-product-csv-importer-controller.php -index fbd20e7..104115b 100644 ---- a/includes/admin/importers/class-wc-product-csv-importer-controller.php -+++ b/includes/admin/importers/class-wc-product-csv-importer-controller.php -@@ -455,11 +455,12 @@ class WC_Product_CSV_Importer_Controller { - */ - protected function done() { - check_admin_referer( 'woocommerce-csv-importer' ); -- $imported = isset( $_GET['products-imported'] ) ? absint( $_GET['products-imported'] ) : 0; -- $updated = isset( $_GET['products-updated'] ) ? absint( $_GET['products-updated'] ) : 0; -- $failed = isset( $_GET['products-failed'] ) ? absint( $_GET['products-failed'] ) : 0; -- $skipped = isset( $_GET['products-skipped'] ) ? absint( $_GET['products-skipped'] ) : 0; -- $errors = array_filter( (array) get_user_option( 'product_import_error_log' ) ); -+ $imported = isset( $_GET['products-imported'] ) ? absint( $_GET['products-imported'] ) : 0; -+ $updated = isset( $_GET['products-updated'] ) ? absint( $_GET['products-updated'] ) : 0; -+ $failed = isset( $_GET['products-failed'] ) ? absint( $_GET['products-failed'] ) : 0; -+ $skipped = isset( $_GET['products-skipped'] ) ? absint( $_GET['products-skipped'] ) : 0; -+ $file_name = isset( $_GET['file-name'] ) ? sanitize_text_field( wp_unslash( $_GET['file-name'] ) ) : ''; -+ $errors = array_filter( (array) get_user_option( 'product_import_error_log' ) ); - - include_once dirname( __FILE__ ) . '/views/html-csv-import-done.php'; - } -diff --git a/includes/admin/importers/views/html-csv-import-done.php b/includes/admin/importers/views/html-csv-import-done.php -index 3f43869..1774001 100644 ---- a/includes/admin/importers/views/html-csv-import-done.php -+++ b/includes/admin/importers/views/html-csv-import-done.php -@@ -50,6 +50,14 @@ if ( ! defined( 'ABSPATH' ) ) { - $results[] = '' . __( 'View import log', 'woocommerce' ) . ''; - } - -+ if ( ! empty( $file_name ) ) { -+ $results[] = sprintf( -+ /* translators: %s: File name */ -+ __( 'File uploaded: %s', 'woocommerce' ), -+ '' . $file_name . '' -+ ); -+ } -+ - /* translators: %d: import results */ - echo wp_kses_post( __( 'Import complete!', 'woocommerce' ) . ' ' . implode( '. ', $results ) ); - ?> From b4034b0f4d5a0ba7fbe416d678b0966a1e6124db Mon Sep 17 00:00:00 2001 From: Seghir Nadir Date: Mon, 17 Feb 2020 13:37:56 +0100 Subject: [PATCH 005/100] add algerian states --- i18n/states.php | 50 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/i18n/states.php b/i18n/states.php index 49aa9b6603a..ad8f548d8cd 100644 --- a/i18n/states.php +++ b/i18n/states.php @@ -292,6 +292,56 @@ return array( 'CZ' => array(), 'DE' => array(), 'DK' => array(), + 'DZ' => array( + 'DZ-01' => __( 'Adrar', 'woocommerce' ), + 'DZ-02' => __( 'Chlef', 'woocommerce' ), + 'DZ-03' => __( 'Laghouat', 'woocommerce' ), + 'DZ-04' => __( 'Oum El Bouaghi', 'woocommerce' ), + 'DZ-05' => __( 'Batna', 'woocommerce' ), + 'DZ-06' => __( 'Béjaïa', 'woocommerce' ), + 'DZ-07' => __( 'Biskra', 'woocommerce' ), + 'DZ-08' => __( 'Bechar', 'woocommerce' ), + 'DZ-09' => __( 'Blida', 'woocommerce' ), + 'DZ-10' => __( 'Bouira', 'woocommerce' ), + 'DZ-11' => __( 'Tamanrasset', 'woocommerce' ), + 'DZ-12' => __( 'Tebessa', 'woocommerce' ), + 'DZ-13' => __( 'Tlemcen', 'woocommerce' ), + 'DZ-14' => __( 'Tiaret', 'woocommerce' ), + 'DZ-15' => __( 'Tizi Ouzou', 'woocommerce' ), + 'DZ-16' => __( 'Alger', 'woocommerce' ), + 'DZ-17' => __( 'Djelfa', 'woocommerce' ), + 'DZ-18' => __( 'Jijel', 'woocommerce' ), + 'DZ-19' => __( 'Setif', 'woocommerce' ), + 'DZ-20' => __( 'Saida', 'woocommerce' ), + 'DZ-21' => __( 'Skikda', 'woocommerce' ), + 'DZ-22' => __( 'Sidi bel abbes', 'woocommerce' ), + 'DZ-23' => __( 'Annaba', 'woocommerce' ), + 'DZ-24' => __( 'Guelma', 'woocommerce' ), + 'DZ-25' => __( 'Constantine', 'woocommerce' ), + 'DZ-26' => __( 'Medea', 'woocommerce' ), + 'DZ-27' => __( 'Mostaghanem', 'woocommerce' ), + 'DZ-28' => __( 'Msila', 'woocommerce' ), + 'DZ-29' => __( 'Mascara', 'woocommerce' ), + 'DZ-30' => __( 'Ouargla', 'woocommerce' ), + 'DZ-31' => __( 'Oran', 'woocommerce' ), + 'DZ-32' => __( 'El Bayadh', 'woocommerce' ), + 'DZ-33' => __( 'Illizi', 'woocommerce' ), + 'DZ-34' => __( 'Bordj Bou Arreridj', 'woocommerce' ), + 'DZ-35' => __( 'Boumerdes', 'woocommerce' ), + 'DZ-36' => __( 'El Taref', 'woocommerce' ), + 'DZ-37' => __( 'Tindouf', 'woocommerce' ), + 'DZ-38' => __( 'Tissemsilt', 'woocommerce' ), + 'DZ-39' => __( 'El Oued', 'woocommerce' ), + 'DZ-40' => __( 'Khenchla', 'woocommerce' ), + 'DZ-41' => __( 'Souk Ahras', 'woocommerce' ), + 'DZ-42' => __( 'Tipaza', 'woocommerce' ), + 'DZ-43' => __( 'Mila', 'woocommerce' ), + 'DZ-44' => __( 'Ain Defla', 'woocommerce' ), + 'DZ-45' => __( 'Naama', 'woocommerce' ), + 'DZ-46' => __( 'Ain Timouchent', 'woocommerce' ), + 'DZ-47' => __( 'Ghardaïa', 'woocommerce' ), + 'DZ-48' => __( 'Relizane', 'woocommerce' ), + ), 'EE' => array(), 'ES' => array( // Spanish states. 'C' => __( 'A Coruña', 'woocommerce' ), From d8e0d956a861d2e2f1948eba363b6b422f49c8ee Mon Sep 17 00:00:00 2001 From: Fernando Marichal Date: Thu, 16 Apr 2020 16:01:13 -0300 Subject: [PATCH 006/100] Modified CSS to solve the removing element problem MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added a `z-index` to the remove button (`x`) to set the z-order of the element. This solves the removing customer from the selector problem. Also, the dropdown arrow width was made smaller --- assets/css/admin.scss | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/assets/css/admin.scss b/assets/css/admin.scss index 67ae21ee00f..6a3ccd76bcf 100644 --- a/assets/css/admin.scss +++ b/assets/css/admin.scss @@ -6680,6 +6680,7 @@ table.bar_chart { .select2-selection__clear { color: #999; margin-top: -1px; + z-index: 1; } .select2-search--inline .select2-search__field { @@ -6773,7 +6774,7 @@ table.bar_chart { .select2-selection__arrow { right: 1px; height: 28px; - width: 28px; + width: 23px; background: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M5%206l5%205%205-5%202%201-7%207-7-7%202-1z%22%20fill%3D%22%23555%22%2F%3E%3C%2Fsvg%3E") no-repeat right 5px top 55%; background-size: 16px 16px; From 232ae1694075a84b15c5bd8979f62da5dd71e99c Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Mon, 20 Apr 2020 12:30:44 +0100 Subject: [PATCH 007/100] Load dependencies in wc_load_cart --- includes/wc-core-functions.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/includes/wc-core-functions.php b/includes/wc-core-functions.php index e197a0ea64c..c314c4d4e63 100644 --- a/includes/wc-core-functions.php +++ b/includes/wc-core-functions.php @@ -2285,8 +2285,15 @@ function wc_load_cart() { return; } + // Ensure dependencies are loaded in all contexts. + include_once WC_ABSPATH . 'includes/wc-cart-functions.php'; + include_once WC_ABSPATH . 'includes/wc-notice-functions.php'; + WC()->initialize_session(); WC()->initialize_cart(); + + // Make sure cart is loaded from session. + WC()->cart->get_cart(); } /** From 88c7ad1bd228d0fc6bf78ac8a51f1496153de353 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Mon, 20 Apr 2020 12:47:20 +0100 Subject: [PATCH 008/100] Don't "get" cart --- includes/wc-core-functions.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/includes/wc-core-functions.php b/includes/wc-core-functions.php index c314c4d4e63..25ff57d3869 100644 --- a/includes/wc-core-functions.php +++ b/includes/wc-core-functions.php @@ -2291,9 +2291,6 @@ function wc_load_cart() { WC()->initialize_session(); WC()->initialize_cart(); - - // Make sure cart is loaded from session. - WC()->cart->get_cart(); } /** From e6e16bee11fe8f4eeeb1126941b3c4c025110b34 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Mon, 27 Apr 2020 23:32:19 -0300 Subject: [PATCH 009/100] Introduced nightly builds workflow --- .github/workflows/nightly-builds.yml | 43 ++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/nightly-builds.yml diff --git a/.github/workflows/nightly-builds.yml b/.github/workflows/nightly-builds.yml new file mode 100644 index 00000000000..2330c38a624 --- /dev/null +++ b/.github/workflows/nightly-builds.yml @@ -0,0 +1,43 @@ +name: Nightly builds +on: + schedule: + - cron: '0 0 * * *' # Run at 12 AM UTC. +jobs: + build: + name: Nightly builds + strategy: + fail-fast: false + matrix: + build: [master] + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + ref: ${{ matrix.build }} + - name: Build + id: build + uses: woocommerce/woocommerce-build-action@master + with: + generate-zip: true + - name: Deploy nightly build + uses: WebFreak001/deploy-nightly@v1.0.3 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: https://uploads.github.com/repos/${{ github.repository }}/releases/25945111/assets{?name,label} + release_id: 25945111 + asset_path: ${{ steps.build.outputs.zip_path }} + asset_name: ${{ github.event.repository.name }}-${{ matrix.build }}-nightly.zip + asset_content_type: application/zip + max_releases: 1 + update: + name: Update nightly tag commit ref + runs-on: ubuntu-latest + steps: + - name: Update nightly tag + uses: richardsimko/github-tag-action@1.0.0 + with: + tag_name: nightly + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From d3b990d7b2530937c09864ca177cf242ec9feddf Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Tue, 28 Apr 2020 11:51:10 -0300 Subject: [PATCH 010/100] Updated zip name --- .github/workflows/nightly-builds.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nightly-builds.yml b/.github/workflows/nightly-builds.yml index 2330c38a624..b4fa9ac3ac5 100644 --- a/.github/workflows/nightly-builds.yml +++ b/.github/workflows/nightly-builds.yml @@ -28,7 +28,7 @@ jobs: upload_url: https://uploads.github.com/repos/${{ github.repository }}/releases/25945111/assets{?name,label} release_id: 25945111 asset_path: ${{ steps.build.outputs.zip_path }} - asset_name: ${{ github.event.repository.name }}-${{ matrix.build }}-nightly.zip + asset_name: woocommerce-${{ matrix.build }}-nightly.zip asset_content_type: application/zip max_releases: 1 update: From 3a585c4e2372c0911a7ecabcebc7177ee58f264d Mon Sep 17 00:00:00 2001 From: Leon Francis Shelhamer Date: Tue, 28 Apr 2020 21:37:55 -0400 Subject: [PATCH 011/100] Conditionally change my account dashboard desc Conditionally change my account dashboard description to reflect whether or not shipping has been disabled in WooCommerce > Settings > General > General options. Signed-off-by: Leon Francis Shelhamer --- includes/wc-account-functions.php | 7 ++++++- templates/myaccount/dashboard.php | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/includes/wc-account-functions.php b/includes/wc-account-functions.php index 07a30b313f9..b5b3591b353 100644 --- a/includes/wc-account-functions.php +++ b/includes/wc-account-functions.php @@ -95,11 +95,16 @@ function wc_get_account_menu_items() { 'customer-logout' => get_option( 'woocommerce_logout_endpoint', 'customer-logout' ), ); + $edit_address = __( 'Address', 'woocommerce' ); + if ( get_option( 'woocommerce_ship_to_countries' ) !== 'disabled' ) { + $edit_address = __( 'Addresses', 'woocommerce' ); + } + $items = array( 'dashboard' => __( 'Dashboard', 'woocommerce' ), 'orders' => __( 'Orders', 'woocommerce' ), 'downloads' => __( 'Downloads', 'woocommerce' ), - 'edit-address' => __( 'Addresses', 'woocommerce' ), + 'edit-address' => $edit_address, 'payment-methods' => __( 'Payment methods', 'woocommerce' ), 'edit-account' => __( 'Account details', 'woocommerce' ), 'customer-logout' => __( 'Logout', 'woocommerce' ), diff --git a/templates/myaccount/dashboard.php b/templates/myaccount/dashboard.php index bb55b7c0683..a69bcc128d0 100644 --- a/templates/myaccount/dashboard.php +++ b/templates/myaccount/dashboard.php @@ -35,8 +35,12 @@ if ( ! defined( 'ABSPATH' ) ) {

recent orders, manage your billing address, and edit your password and account details.', 'woocommerce' ); + if ( get_option( 'woocommerce_ship_to_countries' ) !== 'disabled' ) { + $dashboard_desc = __( 'From your account dashboard you can view your recent orders, manage your shipping and billing addresses, and edit your password and account details.', 'woocommerce' ); + } printf( - __( 'From your account dashboard you can view your recent orders, manage your shipping and billing addresses, and edit your password and account details.', 'woocommerce' ), + $dashboard_desc, esc_url( wc_get_endpoint_url( 'orders' ) ), esc_url( wc_get_endpoint_url( 'edit-address' ) ), esc_url( wc_get_endpoint_url( 'edit-account' ) ) From 9b626d6131f52f47a1efa47fd262e42ee83bd32d Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Wed, 29 Apr 2020 13:36:25 -0300 Subject: [PATCH 012/100] Updated build package name --- .github/workflows/nightly-builds.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nightly-builds.yml b/.github/workflows/nightly-builds.yml index b4fa9ac3ac5..c5bf5a3c3e5 100644 --- a/.github/workflows/nightly-builds.yml +++ b/.github/workflows/nightly-builds.yml @@ -17,7 +17,7 @@ jobs: ref: ${{ matrix.build }} - name: Build id: build - uses: woocommerce/woocommerce-build-action@master + uses: woocommerce/action-build@master with: generate-zip: true - name: Deploy nightly build From 7f5dd5c9975e81ad8e45b6068675eeedb0d4a96a Mon Sep 17 00:00:00 2001 From: Leon Francis Shelhamer Date: Sat, 2 May 2020 18:11:35 -0400 Subject: [PATCH 013/100] Use function to handle plurals Signed-off-by: Leon Francis Shelhamer --- includes/wc-account-functions.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/includes/wc-account-functions.php b/includes/wc-account-functions.php index b5b3591b353..dd1787f0d5d 100644 --- a/includes/wc-account-functions.php +++ b/includes/wc-account-functions.php @@ -95,16 +95,11 @@ function wc_get_account_menu_items() { 'customer-logout' => get_option( 'woocommerce_logout_endpoint', 'customer-logout' ), ); - $edit_address = __( 'Address', 'woocommerce' ); - if ( get_option( 'woocommerce_ship_to_countries' ) !== 'disabled' ) { - $edit_address = __( 'Addresses', 'woocommerce' ); - } - $items = array( 'dashboard' => __( 'Dashboard', 'woocommerce' ), 'orders' => __( 'Orders', 'woocommerce' ), 'downloads' => __( 'Downloads', 'woocommerce' ), - 'edit-address' => $edit_address, + 'edit-address' => _n( 'Address', 'Addresses', (int) wc_shipping_enabled(), 'woocommerce' ), 'payment-methods' => __( 'Payment methods', 'woocommerce' ), 'edit-account' => __( 'Account details', 'woocommerce' ), 'customer-logout' => __( 'Logout', 'woocommerce' ), From fe3de4f02cdf5f86f3c14469fe963b2df6e34a05 Mon Sep 17 00:00:00 2001 From: Leon Francis Shelhamer Date: Sat, 2 May 2020 18:12:16 -0400 Subject: [PATCH 014/100] Change conditional to wc_shipping_enabled Signed-off-by: Leon Francis Shelhamer --- templates/myaccount/dashboard.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/myaccount/dashboard.php b/templates/myaccount/dashboard.php index a69bcc128d0..32845b2e8e2 100644 --- a/templates/myaccount/dashboard.php +++ b/templates/myaccount/dashboard.php @@ -36,7 +36,7 @@ if ( ! defined( 'ABSPATH' ) ) {

recent orders, manage your billing address, and edit your password and account details.', 'woocommerce' ); - if ( get_option( 'woocommerce_ship_to_countries' ) !== 'disabled' ) { + if ( wc_shipping_enabled() ) { $dashboard_desc = __( 'From your account dashboard you can view your recent orders, manage your shipping and billing addresses, and edit your password and account details.', 'woocommerce' ); } printf( From 77c6ddda929dd341c0a12e3dc03c18ed5fb215bd Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Thu, 7 May 2020 00:03:48 -0300 Subject: [PATCH 015/100] Make display_prices_including_tax() aware of tax display changes --- includes/class-wc-cart.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class-wc-cart.php b/includes/class-wc-cart.php index 17378bfbf1b..4508113fbe3 100644 --- a/includes/class-wc-cart.php +++ b/includes/class-wc-cart.php @@ -363,7 +363,7 @@ class WC_Cart extends WC_Legacy_Cart { public function display_prices_including_tax() { $customer_exempt = $this->get_customer() && $this->get_customer()->get_is_vat_exempt(); - return apply_filters( 'woocommerce_cart_' . __FUNCTION__, 'incl' === $this->tax_display_cart && ! $customer_exempt ); + return apply_filters( 'woocommerce_cart_' . __FUNCTION__, 'incl' === $this->is_tax_displayed() && ! $customer_exempt ); } /* From 718943c4dfb9dfe41393b358c0c6833e60813714 Mon Sep 17 00:00:00 2001 From: Leon Francis Shelhamer Date: Thu, 7 May 2020 20:57:30 -0400 Subject: [PATCH 016/100] Address / Addresses strings in correct order for _n() Signed-off-by: Leon Francis Shelhamer --- includes/wc-account-functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/wc-account-functions.php b/includes/wc-account-functions.php index dd1787f0d5d..840990d1d43 100644 --- a/includes/wc-account-functions.php +++ b/includes/wc-account-functions.php @@ -99,7 +99,7 @@ function wc_get_account_menu_items() { 'dashboard' => __( 'Dashboard', 'woocommerce' ), 'orders' => __( 'Orders', 'woocommerce' ), 'downloads' => __( 'Downloads', 'woocommerce' ), - 'edit-address' => _n( 'Address', 'Addresses', (int) wc_shipping_enabled(), 'woocommerce' ), + 'edit-address' => _n( 'Addresses', 'Address', (int) wc_shipping_enabled(), 'woocommerce' ), 'payment-methods' => __( 'Payment methods', 'woocommerce' ), 'edit-account' => __( 'Account details', 'woocommerce' ), 'customer-logout' => __( 'Logout', 'woocommerce' ), From 2e0cfa51ca232a742b18763f14435d88fa7dc982 Mon Sep 17 00:00:00 2001 From: Leon Francis Shelhamer Date: Thu, 7 May 2020 22:45:41 -0400 Subject: [PATCH 017/100] Fix PHPCS errors Signed-off-by: Leon Francis Shelhamer --- templates/myaccount/dashboard.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/templates/myaccount/dashboard.php b/templates/myaccount/dashboard.php index 32845b2e8e2..771a8a4d493 100644 --- a/templates/myaccount/dashboard.php +++ b/templates/myaccount/dashboard.php @@ -26,7 +26,7 @@ if ( ! defined( 'ABSPATH' ) ) { Log out)', 'woocommerce' ), + esc_html__( 'Hello %1$s (not %1$s? Log out)', 'woocommerce' ), '' . esc_html( $current_user->display_name ) . '', esc_url( wc_logout_url() ) ); @@ -35,12 +35,14 @@ if ( ! defined( 'ABSPATH' ) ) {

recent orders, manage your billing address, and edit your password and account details.', 'woocommerce' ); if ( wc_shipping_enabled() ) { + /* translators: 1: Orders URL 2: Addresses URL 3: Account URL. */ $dashboard_desc = __( 'From your account dashboard you can view your recent orders, manage your shipping and billing addresses, and edit your password and account details.', 'woocommerce' ); } printf( - $dashboard_desc, + esc_html( $dashboard_desc ), esc_url( wc_get_endpoint_url( 'orders' ) ), esc_url( wc_get_endpoint_url( 'edit-address' ) ), esc_url( wc_get_endpoint_url( 'edit-account' ) ) From ea9e2f72f96e9b3df567885ef6d0df28e26d2adc Mon Sep 17 00:00:00 2001 From: Leon Francis Shelhamer Date: Thu, 7 May 2020 23:07:51 -0400 Subject: [PATCH 018/100] Add full stop to comment Signed-off-by: Leon Francis Shelhamer --- templates/myaccount/dashboard.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/myaccount/dashboard.php b/templates/myaccount/dashboard.php index 771a8a4d493..e56c8b5a51b 100644 --- a/templates/myaccount/dashboard.php +++ b/templates/myaccount/dashboard.php @@ -18,7 +18,7 @@ */ if ( ! defined( 'ABSPATH' ) ) { - exit; // Exit if accessed directly + exit; // Exit if accessed directly. } ?> From 946c342b1de5680177c96ef3759e5d9ccf90f5bb Mon Sep 17 00:00:00 2001 From: Daniel Stanciu Date: Mon, 11 May 2020 23:57:13 +0300 Subject: [PATCH 019/100] Fix 24885 currency position RTL Wrapped price and currency inside a BDI tag, in order to prevent the bidirectional algorithm to produce confusing results. --- includes/wc-formatting-functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/wc-formatting-functions.php b/includes/wc-formatting-functions.php index 967bb207f34..113e0a40240 100644 --- a/includes/wc-formatting-functions.php +++ b/includes/wc-formatting-functions.php @@ -582,7 +582,7 @@ function wc_price( $price, $args = array() ) { } $formatted_price = ( $negative ? '-' : '' ) . sprintf( $args['price_format'], '' . get_woocommerce_currency_symbol( $args['currency'] ) . '', $price ); - $return = '' . $formatted_price . ''; + $return = '' . $formatted_price . ''; if ( $args['ex_tax_label'] && wc_tax_enabled() ) { $return .= ' ' . WC()->countries->ex_tax_or_vat() . ''; From 4fb66b4ebb5077b9a2839bd0af5acbdc54d325b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20Sz=C3=A9pe?= Date: Wed, 13 May 2020 00:33:29 +0200 Subject: [PATCH 020/100] Make caching in CI predictable and properly name `install:` --- .travis.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index b83de198cf3..e4f35881ab6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,9 +4,8 @@ language: php dist: xenial cache: - directories: - - vendor - - $HOME/.composer/cache + directories: + - $HOME/.composer/cache # Since Xenial services are not started by default, we need to instruct it below to start. services: @@ -66,7 +65,7 @@ jobs: - php: 7.4 env: WP_VERSION=latest WP_MULTISITE=0 RUN_CODE_COVERAGE=1 -before_script: +install: - export PATH="$HOME/.composer/vendor/bin:$PATH" - | # Remove Xdebug for a huge performance increase: From 9458730a1c929775bf458b24fc15f7b8640222a4 Mon Sep 17 00:00:00 2001 From: Knyazevich Date: Thu, 14 May 2020 03:36:13 +0300 Subject: [PATCH 021/100] Fix parameter type and add an empty line in wc_update_product_stock_status --- includes/wc-stock-functions.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/wc-stock-functions.php b/includes/wc-stock-functions.php index 2deb1580e4c..420ce756348 100644 --- a/includes/wc-stock-functions.php +++ b/includes/wc-stock-functions.php @@ -66,10 +66,11 @@ function wc_update_product_stock( $product, $stock_quantity = null, $operation = * Update a product's stock status. * * @param int $product_id Product ID. - * @param int $status Status. + * @param string $status Status. */ function wc_update_product_stock_status( $product_id, $status ) { $product = wc_get_product( $product_id ); + if ( $product ) { $product->set_stock_status( $status ); $product->save(); From 54db5f07c4312c5a34262657a7c91a4ca0d33ca0 Mon Sep 17 00:00:00 2001 From: koko Date: Thu, 14 May 2020 17:10:06 +0200 Subject: [PATCH 022/100] Fix error message in wc_get_template If the filtered template does not exist the error should report the filtered template, not the original --- 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 e197a0ea64c..a1979c59133 100644 --- a/includes/wc-core-functions.php +++ b/includes/wc-core-functions.php @@ -221,7 +221,7 @@ function wc_get_template( $template_name, $args = array(), $template_path = '', if ( $filter_template !== $template ) { if ( ! file_exists( $filter_template ) ) { /* translators: %s template */ - wc_doing_it_wrong( __FUNCTION__, sprintf( __( '%s does not exist.', 'woocommerce' ), '' . $template . '' ), '2.1' ); + wc_doing_it_wrong( __FUNCTION__, sprintf( __( '%s does not exist.', 'woocommerce' ), '' . $filter_template . '' ), '2.1' ); return; } $template = $filter_template; From bf42110179bec471b574e30a51fd0ad697cda28d Mon Sep 17 00:00:00 2001 From: Mat Lipe Date: Thu, 14 May 2020 12:37:29 -0500 Subject: [PATCH 023/100] Fix set cache loop when no attributes exist Test strictly for false to prevent an endless set cache loop when you are not using attribute taxonomies or don't have any set. Prevents `wc_get_attribute_taxonomies` function from calling `wp_cache_set` on every page load. --- includes/wc-attribute-functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/wc-attribute-functions.php b/includes/wc-attribute-functions.php index 24bbd1ef358..658cb2284a3 100644 --- a/includes/wc-attribute-functions.php +++ b/includes/wc-attribute-functions.php @@ -51,7 +51,7 @@ function wc_get_attribute_taxonomies() { $cache_key = $prefix . 'attributes'; $cache_value = wp_cache_get( $cache_key, 'woocommerce-attributes' ); - if ( $cache_value ) { + if ( false !== $cache_value ) { return $cache_value; } From d5952d3b00a9fd84b762be38e3802bf026dd397f Mon Sep 17 00:00:00 2001 From: Pan Seba Date: Mon, 18 May 2020 13:16:30 +0200 Subject: [PATCH 024/100] Trigger removed_coupon_in_checkout event after coupon removal on checkout --- assets/js/frontend/checkout.js | 1 + 1 file changed, 1 insertion(+) diff --git a/assets/js/frontend/checkout.js b/assets/js/frontend/checkout.js index 73a7693bc76..53206f33ca4 100644 --- a/assets/js/frontend/checkout.js +++ b/assets/js/frontend/checkout.js @@ -657,6 +657,7 @@ jQuery( function( $ ) { if ( code ) { $( 'form.woocommerce-checkout' ).before( code ); + $( document.body ).trigger( 'removed_coupon_in_checkout', [ data.coupon_code ] ); $( document.body ).trigger( 'update_checkout', { update_shipping_method: false } ); // Remove coupon code from coupon field From a75c118c02c500e7a134eef141dd2438c5691818 Mon Sep 17 00:00:00 2001 From: Jeffrey Scott French Date: Mon, 18 May 2020 13:48:21 -0400 Subject: [PATCH 025/100] Sets Select a country option value as default on shipping-calculator country select input. --- templates/cart/shipping-calculator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/cart/shipping-calculator.php b/templates/cart/shipping-calculator.php index c908382750c..441ab92e0ad 100644 --- a/templates/cart/shipping-calculator.php +++ b/templates/cart/shipping-calculator.php @@ -28,7 +28,7 @@ do_action( 'woocommerce_before_shipping_calculator' ); ?>

'; + $field = ' From a82dc05e1c21868650c1a83d5ee49878c271ea24 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Wed, 3 Jun 2020 11:55:20 -0300 Subject: [PATCH 049/100] Bump template version --- templates/myaccount/dashboard.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/myaccount/dashboard.php b/templates/myaccount/dashboard.php index e56c8b5a51b..596f0c39934 100644 --- a/templates/myaccount/dashboard.php +++ b/templates/myaccount/dashboard.php @@ -14,7 +14,7 @@ * * @see https://docs.woocommerce.com/document/template-structure/ * @package WooCommerce/Templates - * @version 2.6.0 + * @version 4.3.0 */ if ( ! defined( 'ABSPATH' ) ) { From 1724507a0e3be849e49995e5f3f74592e5632338 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viszt=20Pe=CC=81ter?= Date: Thu, 4 Jun 2020 19:21:41 +0200 Subject: [PATCH 050/100] Fixes for Hungarian address format and name order Missing address-field class for Japan's postcode and state field Checkout layout fixes on country change --- assets/js/frontend/address-i18n.js | 4 ++++ includes/class-wc-countries.php | 27 ++++++++++++++++++++++++--- includes/class-wc-validation.php | 3 +++ 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/assets/js/frontend/address-i18n.js b/assets/js/frontend/address-i18n.js index b2df389d362..7b69d35b6dc 100644 --- a/assets/js/frontend/address-i18n.js +++ b/assets/js/frontend/address-i18n.js @@ -101,6 +101,10 @@ jQuery( function( $ ) { field.show(); } } + + // Class changes. + field.removeClass('form-row-first form-row-last form-row-wide'); + field.addClass(fieldLocale.class.join(' ')); }); var fieldsets = $( diff --git a/includes/class-wc-countries.php b/includes/class-wc-countries.php index 405a0d26cc7..c1a025c3b0c 100644 --- a/includes/class-wc-countries.php +++ b/includes/class-wc-countries.php @@ -516,7 +516,7 @@ class WC_Countries { 'DK' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}", 'FR' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode} {city_upper}\n{country}", 'HK' => "{company}\n{first_name} {last_name_upper}\n{address_1}\n{address_2}\n{city_upper}\n{state_upper}\n{country}", - 'HU' => "{name}\n{company}\n{city}\n{address_1}\n{address_2}\n{postcode}\n{country}", + 'HU' => "{last_name} {first_name}\n{company}\n{city}\n{address_1}\n{address_2}\n{postcode}\n{country}", 'IN' => "{company}\n{name}\n{address_1}\n{address_2}\n{city} {postcode}\n{state}, {country}", 'IS' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}", 'IT' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode}\n{city}\n{state_upper}\n{country}", @@ -981,6 +981,27 @@ class WC_Countries { ), ), 'HU' => array( + 'last_name' => array( + 'class' => array( 'form-row-first' ), + 'priority' => 10, + ), + 'first_name' => array( + 'class' => array( 'form-row-last' ), + 'priority' => 20, + ), + 'postcode' => array( + 'class' => array( 'form-row-first', 'address-field' ), + 'priority' => 65, + ), + 'city' => array( + 'class' => array( 'form-row-last', 'address-field', 'form-row-last' ), + ), + 'address_1' => array( + 'priority' => 71, + ), + 'address_2' => array( + 'priority' => 72, + ), 'state' => array( 'label' => __( 'County', 'woocommerce' ), ), @@ -1039,12 +1060,12 @@ class WC_Countries { 'priority' => 20, ), 'postcode' => array( - 'class' => array( 'form-row-first' ), + 'class' => array( 'form-row-first', 'address-field' ), 'priority' => 65, ), 'state' => array( 'label' => __( 'Prefecture', 'woocommerce' ), - 'class' => array( 'form-row-last' ), + 'class' => array( 'form-row-last', 'address-field' ), 'priority' => 66, ), 'city' => array( diff --git a/includes/class-wc-validation.php b/includes/class-wc-validation.php index 4bdd0931d66..d6144e54bfa 100644 --- a/includes/class-wc-validation.php +++ b/includes/class-wc-validation.php @@ -70,6 +70,9 @@ class WC_Validation { case 'GB': $valid = self::is_gb_postcode( $postcode ); break; + case 'HU': + $valid = (bool) preg_match( '/^([0-9]{4})$/i', $postcode ); + break; case 'IE': $valid = (bool) preg_match( '/([AC-FHKNPRTV-Y]\d{2}|D6W)[0-9AC-FHKNPRTV-Y]{4}/', wc_normalize_postcode( $postcode ) ); break; From 418896ea862c0de9785b9084014298d49ee24b6c Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Thu, 4 Jun 2020 17:18:17 -0300 Subject: [PATCH 051/100] Removed States from Puerto Rico and better address formatting --- i18n/states.php | 1 + includes/class-wc-countries.php | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/i18n/states.php b/i18n/states.php index 6324a790c83..357d02b7083 100644 --- a/i18n/states.php +++ b/i18n/states.php @@ -1062,6 +1062,7 @@ return array( 'SD' => __( 'Sindh', 'woocommerce' ), ), 'PL' => array(), + 'PR' => array(), 'PT' => array(), 'PY' => array( // Paraguay states. 'PY-ASU' => __( 'Asunción', 'woocommerce' ), diff --git a/includes/class-wc-countries.php b/includes/class-wc-countries.php index 405a0d26cc7..ea9ab9224e7 100644 --- a/includes/class-wc-countries.php +++ b/includes/class-wc-countries.php @@ -527,6 +527,7 @@ class WC_Countries { 'NZ' => "{name}\n{company}\n{address_1}\n{address_2}\n{city} {postcode}\n{country}", 'NO' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}", 'PL' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}", + 'PR' => "{company}\n{name}\n{address_1} {address_2}\n{city} {postcode}\n{country}", 'PT' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}", 'SK' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}", 'RS' => "{name}\n{company}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}", @@ -1149,6 +1150,12 @@ class WC_Countries { 'required' => false, ), ), + 'PR' => array( + 'state' => array( + 'required' => false, + 'hidden' => true, + ), + ), 'PT' => array( 'state' => array( 'required' => false, From a240547fdaef2dd7ff1b3500061b7057689ccb84 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Fri, 5 Jun 2020 10:14:52 -0300 Subject: [PATCH 052/100] Puerto Rico: Make city hidden and change state to Municipality --- i18n/states.php | 1 - includes/class-wc-countries.php | 7 +++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/i18n/states.php b/i18n/states.php index 357d02b7083..6324a790c83 100644 --- a/i18n/states.php +++ b/i18n/states.php @@ -1062,7 +1062,6 @@ return array( 'SD' => __( 'Sindh', 'woocommerce' ), ), 'PL' => array(), - 'PR' => array(), 'PT' => array(), 'PY' => array( // Paraguay states. 'PY-ASU' => __( 'Asunción', 'woocommerce' ), diff --git a/includes/class-wc-countries.php b/includes/class-wc-countries.php index ea9ab9224e7..fe73badb21c 100644 --- a/includes/class-wc-countries.php +++ b/includes/class-wc-countries.php @@ -527,7 +527,7 @@ class WC_Countries { 'NZ' => "{name}\n{company}\n{address_1}\n{address_2}\n{city} {postcode}\n{country}", 'NO' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}", 'PL' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}", - 'PR' => "{company}\n{name}\n{address_1} {address_2}\n{city} {postcode}\n{country}", + 'PR' => "{company}\n{name}\n{address_1} {address_2}\n{state} {postcode}\n{country}", 'PT' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}", 'SK' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}", 'RS' => "{name}\n{company}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}", @@ -1151,10 +1151,13 @@ class WC_Countries { ), ), 'PR' => array( - 'state' => array( + 'city' => array( 'required' => false, 'hidden' => true, ), + 'state' => array( + 'label' => __( 'Municipality', 'woocommerce' ), + ), ), 'PT' => array( 'state' => array( From 5dc84e6d0f3a341db1dfd441e22b71b5c4c39faf Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Fri, 5 Jun 2020 14:46:03 -0300 Subject: [PATCH 053/100] Update includes/class-wc-countries.php Co-authored-by: jonathansadowski --- includes/class-wc-countries.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class-wc-countries.php b/includes/class-wc-countries.php index fe73badb21c..74160a1d325 100644 --- a/includes/class-wc-countries.php +++ b/includes/class-wc-countries.php @@ -527,7 +527,7 @@ class WC_Countries { 'NZ' => "{name}\n{company}\n{address_1}\n{address_2}\n{city} {postcode}\n{country}", 'NO' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}", 'PL' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}", - 'PR' => "{company}\n{name}\n{address_1} {address_2}\n{state} {postcode}\n{country}", + 'PR' => "{company}\n{name}\n{address_1} {address_2}\n{state} \n{country} {postcode}", 'PT' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}", 'SK' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}", 'RS' => "{name}\n{company}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}", From 98dfec1523b46dc03b2f4ecc363ae2422a401b1e Mon Sep 17 00:00:00 2001 From: Giorgos Sarigiannidis Date: Mon, 8 Jun 2020 02:30:51 +0300 Subject: [PATCH 054/100] Fix language of Greek states Greek states were defined in Greek instead of English. --- i18n/states.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/i18n/states.php b/i18n/states.php index 6324a790c83..8e7659a7465 100644 --- a/i18n/states.php +++ b/i18n/states.php @@ -370,19 +370,19 @@ return array( ), 'GP' => array(), 'GR' => array( // Greek Regions. - 'I' => __( 'Αττική', 'woocommerce' ), - 'A' => __( 'Ανατολική Μακεδονία και Θράκη', 'woocommerce' ), - 'B' => __( 'Κεντρική Μακεδονία', 'woocommerce' ), - 'C' => __( 'Δυτική Μακεδονία', 'woocommerce' ), - 'D' => __( 'Ήπειρος', 'woocommerce' ), - 'E' => __( 'Θεσσαλία', 'woocommerce' ), - 'F' => __( 'Ιόνιοι Νήσοι', 'woocommerce' ), - 'G' => __( 'Δυτική Ελλάδα', 'woocommerce' ), - 'H' => __( 'Στερεά Ελλάδα', 'woocommerce' ), - 'J' => __( 'Πελοπόννησος', 'woocommerce' ), - 'K' => __( 'Βόρειο Αιγαίο', 'woocommerce' ), - 'L' => __( 'Νότιο Αιγαίο', 'woocommerce' ), - 'M' => __( 'Κρήτη', 'woocommerce' ), + 'I' => __( 'Attica', 'woocommerce' ), + 'A' => __( 'Eastern Macedonia and Thrace', 'woocommerce' ), + 'B' => __( 'Central Macedonia', 'woocommerce' ), + 'C' => __( 'Western Macedonia', 'woocommerce' ), + 'D' => __( 'Epirus', 'woocommerce' ), + 'E' => __( 'Thessaly', 'woocommerce' ), + 'F' => __( 'Ionian Islands', 'woocommerce' ), + 'G' => __( 'Western Greece', 'woocommerce' ), + 'H' => __( 'Central Greece', 'woocommerce' ), + 'J' => __( 'Peloponnese', 'woocommerce' ), + 'K' => __( 'North Aegean', 'woocommerce' ), + 'L' => __( 'South Aegean', 'woocommerce' ), + 'M' => __( 'Crete', 'woocommerce' ), ), 'GF' => array(), 'HK' => array( // Hong Kong states. From 39ecd19645a931c1809b2044d0d35dc67809e338 Mon Sep 17 00:00:00 2001 From: navigatrum <6989338+navigatrum@users.noreply.github.com> Date: Tue, 9 Jun 2020 18:12:27 +0200 Subject: [PATCH 055/100] update PHPUnit minimum version to 6.5 Use PHPUnit v.6.5 instead of v.5.6 for php 7.0 tests. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 106756dd041..7c4e2113129 100644 --- a/.travis.yml +++ b/.travis.yml @@ -79,7 +79,7 @@ before_script: # Install WP Test suite, install PHPUnit globally: if [[ ! -z "$WP_VERSION" ]]; then bash tests/bin/install.sh woocommerce_test root '' localhost $WP_VERSION - composer global require "phpunit/phpunit=5.7.*|7.5.*" + composer global require "phpunit/phpunit=6.5.*|7.5.*" fi - "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16" From 4a60386560c91f7fc3dbcd9ebdf5361ee817addc Mon Sep 17 00:00:00 2001 From: Peter Viszt Date: Wed, 10 Jun 2020 17:54:12 +0200 Subject: [PATCH 056/100] Removed duplicated class from the HU city field --- includes/class-wc-countries.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class-wc-countries.php b/includes/class-wc-countries.php index c1a025c3b0c..32736456d99 100644 --- a/includes/class-wc-countries.php +++ b/includes/class-wc-countries.php @@ -994,7 +994,7 @@ class WC_Countries { 'priority' => 65, ), 'city' => array( - 'class' => array( 'form-row-last', 'address-field', 'form-row-last' ), + 'class' => array( 'form-row-last', 'address-field' ), ), 'address_1' => array( 'priority' => 71, From 56592ce1400551a41d927746cbb9de3530a39a5e Mon Sep 17 00:00:00 2001 From: IanDelMar <42134098+IanDelMar@users.noreply.github.com> Date: Fri, 12 Jun 2020 14:30:54 +0200 Subject: [PATCH 057/100] Fix WPCS sniff exclusion The `WordPress.WP.GlobalVariablesOverride.OverrideProhibited` error code has been replaced by the `WordPress.WP.GlobalVariablesOverride.Prohibited` error code in WPCS v2.0.0. --- templates/checkout/form-pay.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/checkout/form-pay.php b/templates/checkout/form-pay.php index 015cde208e3..98bb85d6996 100644 --- a/templates/checkout/form-pay.php +++ b/templates/checkout/form-pay.php @@ -17,7 +17,7 @@ defined( 'ABSPATH' ) || exit; -$totals = $order->get_order_item_totals(); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.OverrideProhibited +$totals = $order->get_order_item_totals(); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited ?>

From 9bfa9599e661361f7593b119ac944d9d594ed777 Mon Sep 17 00:00:00 2001 From: IanDelMar <42134098+IanDelMar@users.noreply.github.com> Date: Fri, 12 Jun 2020 15:29:35 +0200 Subject: [PATCH 058/100] Fix WPCS sniff exclusion Checking `templates/checkout/form-pay.php` against the WordPress Coding Standards throws an error because the `WordPress.WP.GlobalVariablesOverride.OverrideProhibited` error code has been replaced by the `WordPress.WP.GlobalVariablesOverride.Prohibited` error code in WPCS v2.0.0. --- templates/myaccount/orders.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/myaccount/orders.php b/templates/myaccount/orders.php index aacbd2ef6d3..c50df39b797 100644 --- a/templates/myaccount/orders.php +++ b/templates/myaccount/orders.php @@ -35,7 +35,7 @@ do_action( 'woocommerce_before_account_orders', $has_orders ); ?> orders as $customer_order ) { - $order = wc_get_order( $customer_order ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.OverrideProhibited + $order = wc_get_order( $customer_order ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited $item_count = $order->get_item_count() - $order->get_item_count_refunded(); ?> From 5e8af1b5998d0dce77e7f143e33ed665a3565449 Mon Sep 17 00:00:00 2001 From: IanDelMar <42134098+IanDelMar@users.noreply.github.com> Date: Fri, 12 Jun 2020 15:33:28 +0200 Subject: [PATCH 059/100] Fix WPCS sniff exclusion The `WordPress.WP.GlobalVariablesOverride.OverrideProhibited` error code has been replaced by the `WordPress.WP.GlobalVariablesOverride.Prohibited` error code in WPCS v2.0.0. --- templates/cart/cart-totals.php | 2 +- templates/cart/cross-sells.php | 2 +- templates/checkout/review-order.php | 2 +- templates/myaccount/my-orders.php | 4 ++-- templates/myaccount/orders.php | 2 +- templates/myaccount/payment-methods.php | 4 ++-- templates/order/order-details.php | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/templates/cart/cart-totals.php b/templates/cart/cart-totals.php index 2dedfe8e49a..e9602e0314d 100644 --- a/templates/cart/cart-totals.php +++ b/templates/cart/cart-totals.php @@ -73,7 +73,7 @@ defined( 'ABSPATH' ) || exit; } if ( 'itemized' === get_option( 'woocommerce_tax_total_display' ) ) { - foreach ( WC()->cart->get_tax_totals() as $code => $tax ) { // phpcs:ignore WordPress.WP.GlobalVariablesOverride.OverrideProhibited + foreach ( WC()->cart->get_tax_totals() as $code => $tax ) { // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited ?> label ) . $estimated_text; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> diff --git a/templates/cart/cross-sells.php b/templates/cart/cross-sells.php index c541a0c9d98..6972b42f251 100644 --- a/templates/cart/cross-sells.php +++ b/templates/cart/cross-sells.php @@ -30,7 +30,7 @@ if ( $cross_sells ) : ?> get_id() ); - setup_postdata( $GLOBALS['post'] =& $post_object ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.OverrideProhibited, Squiz.PHP.DisallowMultipleAssignments.Found + setup_postdata( $GLOBALS['post'] =& $post_object ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited, Squiz.PHP.DisallowMultipleAssignments.Found wc_get_template_part( 'content', 'product' ); ?> diff --git a/templates/checkout/review-order.php b/templates/checkout/review-order.php index 1df0bea5b09..3fb3639f806 100644 --- a/templates/checkout/review-order.php +++ b/templates/checkout/review-order.php @@ -83,7 +83,7 @@ defined( 'ABSPATH' ) || exit; cart->display_prices_including_tax() ) : ?> - cart->get_tax_totals() as $code => $tax ) : // phpcs:ignore WordPress.WP.GlobalVariablesOverride.OverrideProhibited ?> + cart->get_tax_totals() as $code => $tax ) : // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited ?> label ); ?> formatted_amount ); ?> diff --git a/templates/myaccount/my-orders.php b/templates/myaccount/my-orders.php index 9cc0f4de0e8..0b671f01325 100644 --- a/templates/myaccount/my-orders.php +++ b/templates/myaccount/my-orders.php @@ -49,7 +49,7 @@ if ( $customer_orders ) : ?> get_item_count(); ?> @@ -80,7 +80,7 @@ if ( $customer_orders ) : ?> $actions = wc_get_account_orders_actions( $order ); if ( ! empty( $actions ) ) { - foreach ( $actions as $key => $action ) { // phpcs:ignore WordPress.WP.GlobalVariablesOverride.OverrideProhibited + foreach ( $actions as $key => $action ) { // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited echo '' . esc_html( $action['name'] ) . ''; } } diff --git a/templates/myaccount/orders.php b/templates/myaccount/orders.php index c50df39b797..b9059b9cfc6 100644 --- a/templates/myaccount/orders.php +++ b/templates/myaccount/orders.php @@ -66,7 +66,7 @@ do_action( 'woocommerce_before_account_orders', $has_orders ); ?> $actions = wc_get_account_orders_actions( $order ); if ( ! empty( $actions ) ) { - foreach ( $actions as $key => $action ) { // phpcs:ignore WordPress.WP.GlobalVariablesOverride.OverrideProhibited + foreach ( $actions as $key => $action ) { // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited echo '' . esc_html( $action['name'] ) . ''; } } diff --git a/templates/myaccount/payment-methods.php b/templates/myaccount/payment-methods.php index 8d00b9fbb31..a016cf2445c 100644 --- a/templates/myaccount/payment-methods.php +++ b/templates/myaccount/payment-methods.php @@ -35,7 +35,7 @@ do_action( 'woocommerce_before_account_payment_methods', $has_methods ); ?> - $methods ) : // phpcs:ignore WordPress.WP.GlobalVariablesOverride.OverrideProhibited ?> + $methods ) : // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited ?> $column_name ) : ?> @@ -53,7 +53,7 @@ do_action( 'woocommerce_before_account_payment_methods', $has_methods ); ?> } elseif ( 'expires' === $column_id ) { echo esc_html( $method['expires'] ); } elseif ( 'actions' === $column_id ) { - foreach ( $method['actions'] as $key => $action ) { // phpcs:ignore WordPress.WP.GlobalVariablesOverride.OverrideProhibited + foreach ( $method['actions'] as $key => $action ) { // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited echo '' . esc_html( $action['name'] ) . ' '; } } diff --git a/templates/order/order-details.php b/templates/order/order-details.php index 4e5a1d0e915..17f82e1bc27 100644 --- a/templates/order/order-details.php +++ b/templates/order/order-details.php @@ -17,7 +17,7 @@ defined( 'ABSPATH' ) || exit; -$order = wc_get_order( $order_id ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.OverrideProhibited +$order = wc_get_order( $order_id ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited if ( ! $order ) { return; From 80d6b94b42cf4b1f6c8a3bd5afd5eda91e003ae0 Mon Sep 17 00:00:00 2001 From: Leon Francis Shelhamer Date: Tue, 16 Jun 2020 03:58:55 -0400 Subject: [PATCH 060/100] Preserve anchors when escaping text. Signed-off-by: Leon Francis Shelhamer --- templates/myaccount/dashboard.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/templates/myaccount/dashboard.php b/templates/myaccount/dashboard.php index 596f0c39934..ecfd20f579d 100644 --- a/templates/myaccount/dashboard.php +++ b/templates/myaccount/dashboard.php @@ -24,9 +24,14 @@ if ( ! defined( 'ABSPATH' ) ) {

array( + 'href' => array(), + ), + ); printf( /* translators: 1: user display name 2: logout url */ - esc_html__( 'Hello %1$s (not %1$s? Log out)', 'woocommerce' ), + wp_kses( __( 'Hello %1$s (not %1$s? Log out)', 'woocommerce' ), $allowed_html ), '' . esc_html( $current_user->display_name ) . '', esc_url( wc_logout_url() ) ); @@ -42,7 +47,7 @@ if ( ! defined( 'ABSPATH' ) ) { $dashboard_desc = __( 'From your account dashboard you can view your recent orders, manage your shipping and billing addresses, and edit your password and account details.', 'woocommerce' ); } printf( - esc_html( $dashboard_desc ), + wp_kses( $dashboard_desc, $allowed_html ), esc_url( wc_get_endpoint_url( 'orders' ) ), esc_url( wc_get_endpoint_url( 'edit-address' ) ), esc_url( wc_get_endpoint_url( 'edit-account' ) ) From cd3777ddca2388cb8d59364bdaf46da75f00844e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albert=20Juh=C3=A9=20Lluveras?= Date: Thu, 14 May 2020 17:45:42 +0200 Subject: [PATCH 061/100] Product grid blocks in TwentyTwenty: align 'Sale' badge to the top right --- assets/css/twenty-twenty.scss | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/assets/css/twenty-twenty.scss b/assets/css/twenty-twenty.scss index eab9fb5f2d2..642a161adeb 100644 --- a/assets/css/twenty-twenty.scss +++ b/assets/css/twenty-twenty.scss @@ -173,7 +173,8 @@ a.button { .wc-block-grid__product-onsale { position: absolute; - top: 0; + right: 4px; + top: 4px; display: inline-block; background: $highlights-color; color: #fff; @@ -184,6 +185,7 @@ a.button { text-transform: uppercase; z-index: 1; font-size: 1.5rem; + margin: 0; padding: 1rem; } } From 4931fd9d0661337e339b63edf4edfad2a45ba82b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albert=20Juh=C3=A9=20Lluveras?= Date: Thu, 14 May 2020 17:46:15 +0200 Subject: [PATCH 062/100] Product grid blocks in TwentyTwenty: make product title underline black --- assets/css/twenty-twenty.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/assets/css/twenty-twenty.scss b/assets/css/twenty-twenty.scss index 642a161adeb..268c575388e 100644 --- a/assets/css/twenty-twenty.scss +++ b/assets/css/twenty-twenty.scss @@ -2126,6 +2126,10 @@ ul.wc-block-grid__products { .wc-block-grid__product { + .wc-block-grid__product-link { + color: #000; + } + .wc-block-grid__product-title { font-family: $headings; color: #000; From 7f5da2eebb8c61210b9aeef2057a2ea6d1c5bed7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albert=20Juh=C3=A9=20Lluveras?= Date: Thu, 14 May 2020 17:46:52 +0200 Subject: [PATCH 063/100] All Products block in TwentyTwenty: same styles as product grid blocks --- assets/css/twenty-twenty.scss | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/assets/css/twenty-twenty.scss b/assets/css/twenty-twenty.scss index 268c575388e..460c83f41c9 100644 --- a/assets/css/twenty-twenty.scss +++ b/assets/css/twenty-twenty.scss @@ -2138,14 +2138,16 @@ ul.wc-block-grid__products { .wc-block-grid__product-price { + .wc-block-grid__product-price__value, .woocommerce-Price-amount { - + font-family: $headings; font-size: 1.8rem; } } .wc-block-grid__product-rating { + .wc-block-grid__product-rating__stars, .star-rating { font-size: 0.7em; } From eed277b37d9db28e39d0eff3f8980de7d182a336 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albert=20Juh=C3=A9=20Lluveras?= Date: Thu, 14 May 2020 17:47:14 +0200 Subject: [PATCH 064/100] Product grid blocks in TwentyTwenty: remove flex styles --- assets/css/twenty-twenty.scss | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/assets/css/twenty-twenty.scss b/assets/css/twenty-twenty.scss index 460c83f41c9..a88f8c14a46 100644 --- a/assets/css/twenty-twenty.scss +++ b/assets/css/twenty-twenty.scss @@ -2109,21 +2109,6 @@ a.reset_variations { } } -ul.wc-block-grid__products { - display: flex; - align-items: stretch; - flex-direction: row; - flex-wrap: wrap; - - li.wc-block-grid__product { - display: flex; - flex-direction: column; - justify-content: space-between; - align-items: center; - margin-bottom: 5em; - } -} - .wc-block-grid__product { .wc-block-grid__product-link { From 646a460c703061c44af963ddac2d53deab99d86c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albert=20Juh=C3=A9=20Lluveras?= Date: Wed, 20 May 2020 09:53:13 +0200 Subject: [PATCH 065/100] Remove WC Blocks styles from TwentyTwenty CSS --- assets/css/twenty-twenty.scss | 67 ----------------------------------- 1 file changed, 67 deletions(-) diff --git a/assets/css/twenty-twenty.scss b/assets/css/twenty-twenty.scss index a88f8c14a46..5971594aa92 100644 --- a/assets/css/twenty-twenty.scss +++ b/assets/css/twenty-twenty.scss @@ -169,27 +169,6 @@ a.button { z-index: 1; } -.wc-block-grid__products { - - .wc-block-grid__product-onsale { - position: absolute; - right: 4px; - top: 4px; - display: inline-block; - background: $highlights-color; - color: #fff; - font-family: $headings; - font-weight: 700; - letter-spacing: -0.02em; - line-height: 1.2; - text-transform: uppercase; - z-index: 1; - font-size: 1.5rem; - margin: 0; - padding: 1rem; - } -} - .price { font-family: $headings; @@ -2109,36 +2088,6 @@ a.reset_variations { } } -.wc-block-grid__product { - - .wc-block-grid__product-link { - color: #000; - } - - .wc-block-grid__product-title { - font-family: $headings; - color: #000; - font-size: 2.5rem; - } - - .wc-block-grid__product-price { - - .wc-block-grid__product-price__value, - .woocommerce-Price-amount { - font-family: $headings; - font-size: 1.8rem; - } - } - - .wc-block-grid__product-rating { - - .wc-block-grid__product-rating__stars, - .star-rating { - font-size: 0.7em; - } - } -} - @media only screen and (max-width: 600px) { .woocommerce { @@ -2428,14 +2377,6 @@ a.reset_variations { } } - .wc-block-grid__products { - - .wc-block-grid__product-onsale { - font-size: 1.5rem; - padding: 1rem; - } - } - /** * Shop page */ @@ -2589,14 +2530,6 @@ a.reset_variations { } } - .wc-block-grid__products { - - .wc-block-grid__product-onsale { - font-size: 1.7rem; - padding: 1.5rem; - } - } - .woocommerce-breadcrumb { margin-bottom: 5rem; font-size: 0.88889em; From 94e317f9f8932822789ed5624eb7e2859f59fe2e Mon Sep 17 00:00:00 2001 From: Daniel Morell Date: Wed, 17 Jun 2020 10:49:40 -0500 Subject: [PATCH 066/100] Fixed wc_get_order function name The WC_Abstract_Order __construct() method doc block had the wc_get_order() method referred to as get_order(). --- includes/abstracts/abstract-wc-order.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/abstracts/abstract-wc-order.php b/includes/abstracts/abstract-wc-order.php index 9c0f2618f7e..31fbbc7d7b4 100644 --- a/includes/abstracts/abstract-wc-order.php +++ b/includes/abstracts/abstract-wc-order.php @@ -87,8 +87,8 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order { /** * Get the order if ID is passed, otherwise the order is new and empty. - * This class should NOT be instantiated, but the get_order function or new WC_Order_Factory. - * should be used. It is possible, but the aforementioned are preferred and are the only. + * This class should NOT be instantiated, but the wc_get_order function or new WC_Order_Factory + * should be used. It is possible, but the aforementioned are preferred and are the only * methods that will be maintained going forward. * * @param int|object|WC_Order $order Order to read. From 06a7847f73ffaa9d5e2efcb9e0ed5ef8cde3e55e Mon Sep 17 00:00:00 2001 From: Manos Psychogyiopoulos Date: Thu, 18 Jun 2020 07:42:25 +0300 Subject: [PATCH 067/100] Preserve qty input val whan changing variations --- assets/js/frontend/add-to-cart-variation.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/assets/js/frontend/add-to-cart-variation.js b/assets/js/frontend/add-to-cart-variation.js index c7c603725ee..2dd3c209945 100644 --- a/assets/js/frontend/add-to-cart-variation.js +++ b/assets/js/frontend/add-to-cart-variation.js @@ -293,7 +293,18 @@ $qty.find( 'input.qty' ).val( '1' ).attr( 'min', '1' ).attr( 'max', '' ).change(); $qty.hide(); } else { - $qty.find( 'input.qty' ).attr( 'min', variation.min_qty ).attr( 'max', variation.max_qty ).val( variation.min_qty ).change(); + + var $qty_input = $qty.find( 'input.qty' ), + qty_val = parseFloat( $qty_input.val() ); + + if ( isNaN( qty_val ) ) { + qty_val = variation.min_qty; + } else { + qty_val = qty_val > parseFloat( variation.max_qty ) ? variation.max_qty : qty_val; + qty_val = qty_val < parseFloat( variation.min_qty ) ? variation.min_qty : qty_val; + } + + $qty_input.attr( 'min', variation.min_qty ).attr( 'max', variation.max_qty ).val( qty_val ).change(); $qty.show(); } From bc210d6db1cac9f8e24b986927287ce4f363e107 Mon Sep 17 00:00:00 2001 From: Ken Gagne Date: Mon, 22 Jun 2020 09:57:28 -0600 Subject: [PATCH 068/100] Add login link for existing account When a logged-out user tries to check out with an email address associated with an existing account, they are prompted to log in. This PR updates that prompt with a link to the login form. Though other opportunities to log in should already exist elsewhere on the checkout page (such as `form-login.php`'s "Returning customer?" prompt), this change makes it more explicit and intuitive. --- includes/wc-user-functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/wc-user-functions.php b/includes/wc-user-functions.php index cd1b97504ec..5d49e84ae37 100644 --- a/includes/wc-user-functions.php +++ b/includes/wc-user-functions.php @@ -44,7 +44,7 @@ if ( ! function_exists( 'wc_create_new_customer' ) ) { } if ( email_exists( $email ) ) { - return new WP_Error( 'registration-error-email-exists', apply_filters( 'woocommerce_registration_error_email_exists', __( 'An account is already registered with your email address. Please log in.', 'woocommerce' ), $email ) ); + return new WP_Error( 'registration-error-email-exists', apply_filters( 'woocommerce_registration_error_email_exists', __( 'An account is already registered with your email address. Please log in.', 'woocommerce' ), $email ) ); } if ( 'yes' === get_option( 'woocommerce_registration_generate_username', 'yes' ) && empty( $username ) ) { From 9cddd9ae18e0e40c5daa820599f687adabdd7d19 Mon Sep 17 00:00:00 2001 From: Dan Bitzer Date: Tue, 23 Jun 2020 16:51:57 +0930 Subject: [PATCH 069/100] Add `woocommerce_order_note_added` action This action provides an easier way to perform an action when a non-customer order note is added. --- includes/class-wc-order.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/includes/class-wc-order.php b/includes/class-wc-order.php index a43455d2fcb..6878cacfbcf 100644 --- a/includes/class-wc-order.php +++ b/includes/class-wc-order.php @@ -1731,6 +1731,8 @@ class WC_Order extends WC_Abstract_Order { ); } + do_action( 'woocommerce_order_note_added', $comment_id, $this ); + return $comment_id; } From ca9a76c462987b8aa2af61cd3c85b1010434fe47 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Tue, 23 Jun 2020 10:46:26 -0300 Subject: [PATCH 070/100] Fixed coding standards --- assets/js/frontend/address-i18n.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/js/frontend/address-i18n.js b/assets/js/frontend/address-i18n.js index 7b69d35b6dc..6ab1bfbeda2 100644 --- a/assets/js/frontend/address-i18n.js +++ b/assets/js/frontend/address-i18n.js @@ -103,8 +103,8 @@ jQuery( function( $ ) { } // Class changes. - field.removeClass('form-row-first form-row-last form-row-wide'); - field.addClass(fieldLocale.class.join(' ')); + field.removeClass( 'form-row-first form-row-last form-row-wide' ); + field.addClass( fieldLocale.class.join( ' ' ) ); }); var fieldsets = $( From f2299ecfa81d8663329d7789250b0d5f669094d5 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Tue, 23 Jun 2020 11:09:21 -0300 Subject: [PATCH 071/100] Fixed coding standards --- includes/class-wc-countries.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/class-wc-countries.php b/includes/class-wc-countries.php index 32736456d99..cfc92a06d44 100644 --- a/includes/class-wc-countries.php +++ b/includes/class-wc-countries.php @@ -982,15 +982,15 @@ class WC_Countries { ), 'HU' => array( 'last_name' => array( - 'class' => array( 'form-row-first' ), + 'class' => array( 'form-row-first' ), 'priority' => 10, ), 'first_name' => array( - 'class' => array( 'form-row-last' ), + 'class' => array( 'form-row-last' ), 'priority' => 20, ), 'postcode' => array( - 'class' => array( 'form-row-first', 'address-field' ), + 'class' => array( 'form-row-first', 'address-field' ), 'priority' => 65, ), 'city' => array( From ee3a1b7e5e2e079da7c24a9b215b4fb5035fcc26 Mon Sep 17 00:00:00 2001 From: Giorgos Sarigiannidis Date: Tue, 23 Jun 2020 17:47:31 +0300 Subject: [PATCH 072/100] Update states.php Updated Greek states based on the names from the CLDR list (see: https://github.com/woocommerce/woocommerce/pull/26719#pullrequestreview-435847710) --- i18n/states.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/i18n/states.php b/i18n/states.php index 8e7659a7465..4430fe6976f 100644 --- a/i18n/states.php +++ b/i18n/states.php @@ -370,14 +370,14 @@ return array( ), 'GP' => array(), 'GR' => array( // Greek Regions. - 'I' => __( 'Attica', 'woocommerce' ), - 'A' => __( 'Eastern Macedonia and Thrace', 'woocommerce' ), + 'I' => __( 'Attica Department', 'woocommerce' ), + 'A' => __( 'East Macedonia and Thrace', 'woocommerce' ), 'B' => __( 'Central Macedonia', 'woocommerce' ), - 'C' => __( 'Western Macedonia', 'woocommerce' ), + 'C' => __( 'West Macedonia', 'woocommerce' ), 'D' => __( 'Epirus', 'woocommerce' ), 'E' => __( 'Thessaly', 'woocommerce' ), 'F' => __( 'Ionian Islands', 'woocommerce' ), - 'G' => __( 'Western Greece', 'woocommerce' ), + 'G' => __( 'West Greece', 'woocommerce' ), 'H' => __( 'Central Greece', 'woocommerce' ), 'J' => __( 'Peloponnese', 'woocommerce' ), 'K' => __( 'North Aegean', 'woocommerce' ), From 6890251b0ef1a35d2edd7b01a37ed1a9b2c0032a Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Tue, 23 Jun 2020 11:51:19 -0300 Subject: [PATCH 073/100] Fixed typos and coding standards --- includes/class-wc-post-types.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/includes/class-wc-post-types.php b/includes/class-wc-post-types.php index 069ed7cdf56..c382f13c7b5 100644 --- a/includes/class-wc-post-types.php +++ b/includes/class-wc-post-types.php @@ -483,20 +483,18 @@ class WC_Post_Types { /** * Customize taxonomies update messages. * - * @access public * @param array $messages The list of available messages. - * @since 4.1.2 + * @since 4.4.0 * @return bool */ public function updated_term_messages( $messages ) { - $messages['product_cat'] = array( 0 => '', 1 => __( 'Category added.', 'woocommerce' ), 2 => __( 'Category deleted.', 'woocommerce' ), 3 => __( 'Category updated.', 'woocommerce' ), 4 => __( 'Category not added.', 'woocommerce' ), - 5 => __( 'Category not updated.', 'woocommerce-' ), + 5 => __( 'Category not updated.', 'woocommerce' ), 6 => __( 'Category not deleted.', 'woocommerce' ), ); @@ -520,7 +518,7 @@ class WC_Post_Types { if ( $name ) { $label = ! empty( $tax->attribute_label ) ? $tax->attribute_label : $tax->attribute_name; - $messages[$name] = array( + $messages[ $name ] = array( 0 => '', /* translators: %s: taxonomy label */ 1 => sprintf( __( '%s added', 'woocommerce' ), $label ), From 77f1842a9ae1f26c2a666913a1468a16e4d5a3d3 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Tue, 23 Jun 2020 14:36:30 -0300 Subject: [PATCH 074/100] Fixed "Attica" name --- i18n/states.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i18n/states.php b/i18n/states.php index 4430fe6976f..08c08cd8621 100644 --- a/i18n/states.php +++ b/i18n/states.php @@ -370,7 +370,7 @@ return array( ), 'GP' => array(), 'GR' => array( // Greek Regions. - 'I' => __( 'Attica Department', 'woocommerce' ), + 'I' => __( 'Attica', 'woocommerce' ), 'A' => __( 'East Macedonia and Thrace', 'woocommerce' ), 'B' => __( 'Central Macedonia', 'woocommerce' ), 'C' => __( 'West Macedonia', 'woocommerce' ), From a008e8a9ac5cf0ea3250825447e0581d21f3d4ae Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Tue, 23 Jun 2020 16:40:53 -0300 Subject: [PATCH 075/100] Fixed coding standards --- assets/js/admin/wc-product-import.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/js/admin/wc-product-import.js b/assets/js/admin/wc-product-import.js index 967d84f6ef5..3e88df8a553 100644 --- a/assets/js/admin/wc-product-import.js +++ b/assets/js/admin/wc-product-import.js @@ -58,8 +58,8 @@ $this.$form.find('.woocommerce-importer-progress').val( response.data.percentage ); if ( 'done' === response.data.position ) { - var file_name = wc_product_import_params.file.split('/').pop(); - window.location = response.data.url + '&products-imported=' + parseInt( $this.imported, 10 ) + '&products-failed=' + parseInt( $this.failed, 10 ) + '&products-updated=' + parseInt( $this.updated, 10 ) + '&products-skipped=' + parseInt( $this.skipped, 10 )+'&file-name='+file_name; + var file_name = wc_product_import_params.file.split( '/' ).pop(); + window.location = response.data.url + '&products-imported=' + parseInt( $this.imported, 10 ) + '&products-failed=' + parseInt( $this.failed, 10 ) + '&products-updated=' + parseInt( $this.updated, 10 ) + '&products-skipped=' + parseInt( $this.skipped, 10 ) + '&file-name=' + file_name; } else { $this.run_import(); } From da19e6af278d80190ddb7196d6e32b19326b4201 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Tue, 23 Jun 2020 17:14:59 -0300 Subject: [PATCH 076/100] Updated algerian states based on the CLDR list Based on https://github.com/unicode-org/cldr/blob/release-37/common/subdivisions/en.xml#L1176-L1224 --- i18n/states.php | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/i18n/states.php b/i18n/states.php index ad8f548d8cd..77a192b2aa8 100644 --- a/i18n/states.php +++ b/i18n/states.php @@ -298,48 +298,48 @@ return array( 'DZ-03' => __( 'Laghouat', 'woocommerce' ), 'DZ-04' => __( 'Oum El Bouaghi', 'woocommerce' ), 'DZ-05' => __( 'Batna', 'woocommerce' ), - 'DZ-06' => __( 'Béjaïa', 'woocommerce' ), + 'DZ-06' => __( 'Béjaïa', 'woocommerce' ), 'DZ-07' => __( 'Biskra', 'woocommerce' ), - 'DZ-08' => __( 'Bechar', 'woocommerce' ), + 'DZ-08' => __( 'Béchar', 'woocommerce' ), 'DZ-09' => __( 'Blida', 'woocommerce' ), 'DZ-10' => __( 'Bouira', 'woocommerce' ), - 'DZ-11' => __( 'Tamanrasset', 'woocommerce' ), - 'DZ-12' => __( 'Tebessa', 'woocommerce' ), + 'DZ-11' => __( 'Tamanghasset', 'woocommerce' ), + 'DZ-12' => __( 'Tébessa', 'woocommerce' ), 'DZ-13' => __( 'Tlemcen', 'woocommerce' ), 'DZ-14' => __( 'Tiaret', 'woocommerce' ), 'DZ-15' => __( 'Tizi Ouzou', 'woocommerce' ), - 'DZ-16' => __( 'Alger', 'woocommerce' ), + 'DZ-16' => __( 'Algiers', 'woocommerce' ), 'DZ-17' => __( 'Djelfa', 'woocommerce' ), 'DZ-18' => __( 'Jijel', 'woocommerce' ), - 'DZ-19' => __( 'Setif', 'woocommerce' ), - 'DZ-20' => __( 'Saida', 'woocommerce' ), + 'DZ-19' => __( 'Sétif', 'woocommerce' ), + 'DZ-20' => __( 'Saïda', 'woocommerce' ), 'DZ-21' => __( 'Skikda', 'woocommerce' ), - 'DZ-22' => __( 'Sidi bel abbes', 'woocommerce' ), + 'DZ-22' => __( 'Sidi Bel Abbès', 'woocommerce' ), 'DZ-23' => __( 'Annaba', 'woocommerce' ), 'DZ-24' => __( 'Guelma', 'woocommerce' ), 'DZ-25' => __( 'Constantine', 'woocommerce' ), - 'DZ-26' => __( 'Medea', 'woocommerce' ), - 'DZ-27' => __( 'Mostaghanem', 'woocommerce' ), - 'DZ-28' => __( 'Msila', 'woocommerce' ), + 'DZ-26' => __( 'Médéa', 'woocommerce' ), + 'DZ-27' => __( 'Mostaganem', 'woocommerce' ), + 'DZ-28' => __( 'M’Sila', 'woocommerce' ), 'DZ-29' => __( 'Mascara', 'woocommerce' ), 'DZ-30' => __( 'Ouargla', 'woocommerce' ), 'DZ-31' => __( 'Oran', 'woocommerce' ), 'DZ-32' => __( 'El Bayadh', 'woocommerce' ), 'DZ-33' => __( 'Illizi', 'woocommerce' ), - 'DZ-34' => __( 'Bordj Bou Arreridj', 'woocommerce' ), - 'DZ-35' => __( 'Boumerdes', 'woocommerce' ), - 'DZ-36' => __( 'El Taref', 'woocommerce' ), + 'DZ-34' => __( 'Bordj Bou Arréridj', 'woocommerce' ), + 'DZ-35' => __( 'Boumerdès', 'woocommerce' ), + 'DZ-36' => __( 'El Tarf', 'woocommerce' ), 'DZ-37' => __( 'Tindouf', 'woocommerce' ), 'DZ-38' => __( 'Tissemsilt', 'woocommerce' ), 'DZ-39' => __( 'El Oued', 'woocommerce' ), - 'DZ-40' => __( 'Khenchla', 'woocommerce' ), + 'DZ-40' => __( 'Khenchela', 'woocommerce' ), 'DZ-41' => __( 'Souk Ahras', 'woocommerce' ), - 'DZ-42' => __( 'Tipaza', 'woocommerce' ), + 'DZ-42' => __( 'Tipasa', 'woocommerce' ), 'DZ-43' => __( 'Mila', 'woocommerce' ), - 'DZ-44' => __( 'Ain Defla', 'woocommerce' ), + 'DZ-44' => __( 'Aïn Defla', 'woocommerce' ), 'DZ-45' => __( 'Naama', 'woocommerce' ), - 'DZ-46' => __( 'Ain Timouchent', 'woocommerce' ), - 'DZ-47' => __( 'Ghardaïa', 'woocommerce' ), + 'DZ-46' => __( 'Aïn Témouchent', 'woocommerce' ), + 'DZ-47' => __( 'Ghardaïa', 'woocommerce' ), 'DZ-48' => __( 'Relizane', 'woocommerce' ), ), 'EE' => array(), From 25fbe5887298ce4c649c4310b4825170f30f9912 Mon Sep 17 00:00:00 2001 From: Dan Bitzer Date: Wed, 24 Jun 2020 09:35:46 +0930 Subject: [PATCH 077/100] Add order note action docblock --- includes/class-wc-order.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/includes/class-wc-order.php b/includes/class-wc-order.php index 6878cacfbcf..0fe6886a7e3 100644 --- a/includes/class-wc-order.php +++ b/includes/class-wc-order.php @@ -1731,6 +1731,14 @@ class WC_Order extends WC_Abstract_Order { ); } + /** + * Action hook fired after an order note is added. + * + * @param int $order_note_id Order note ID. + * @param WC_Order $order Order data. + * + * @since 4.4.0 + */ do_action( 'woocommerce_order_note_added', $comment_id, $this ); return $comment_id; From c3afafee76620d84f11b8233dc622e8e03591f46 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Wed, 24 Jun 2020 11:53:39 -0300 Subject: [PATCH 078/100] Update template version --- templates/myaccount/dashboard.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/templates/myaccount/dashboard.php b/templates/myaccount/dashboard.php index ecfd20f579d..d1a413e50ce 100644 --- a/templates/myaccount/dashboard.php +++ b/templates/myaccount/dashboard.php @@ -12,23 +12,24 @@ * 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/ - * @package WooCommerce/Templates - * @version 4.3.0 + * @see https://docs.woocommerce.com/document/template-structure/ + * @package WooCommerce/Templates + * @version 4.4.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } + +$allowed_html = array( + 'a' => array( + 'href' => array(), + ), +); ?>

array( - 'href' => array(), - ), - ); printf( /* translators: 1: user display name 2: logout url */ wp_kses( __( 'Hello %1$s (not %1$s? Log out)', 'woocommerce' ), $allowed_html ), From ce70d6ad7a68363b1a4e9f00d2d4dd1e028117e2 Mon Sep 17 00:00:00 2001 From: Ron Rennick Date: Wed, 24 Jun 2020 14:26:25 -0300 Subject: [PATCH 079/100] add Google weblight user agent check --- includes/class-wc-cache-helper.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/includes/class-wc-cache-helper.php b/includes/class-wc-cache-helper.php index 6863411df0f..e526659cbea 100644 --- a/includes/class-wc-cache-helper.php +++ b/includes/class-wc-cache-helper.php @@ -40,12 +40,14 @@ class WC_Cache_Helper { * @since 3.6.0 */ public static function additional_nocache_headers( $headers ) { + $agent = isset( $_SERVER['HTTP_USER_AGENT'] ) ? wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized /** - * Allow CDN plugins to disable nocache headers. + * Allow plugins to enable nocache headers. Enabled for Google weblight. * - * @param bool $enable_nocache_headers Flag indicating whether to add nocache headers. Default: true. + * @see https://support.google.com/webmasters/answer/1061943?hl=en + * @param bool $enable_nocache_headers Flag indicating whether to add nocache headers. Default: false. */ - if ( apply_filters( 'woocommerce_enable_nocache_headers', true ) ) { + if ( false !== strpos( $agent, 'googleweblight' ) || apply_filters( 'woocommerce_enable_nocache_headers', false ) ) { // no-transform: Opt-out of Google weblight. https://support.google.com/webmasters/answer/6211428?hl=en. $headers['Cache-Control'] = 'no-transform, no-cache, no-store, must-revalidate'; } From 75cd74fe2436184a6a59a7a41f4630ee212e56c7 Mon Sep 17 00:00:00 2001 From: Paul Sealock Date: Thu, 25 Jun 2020 15:23:50 +1200 Subject: [PATCH 080/100] Bump wc-admin version 1.3.0-rc.2 --- composer.json | 2 +- composer.lock | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index e2c31e99b5a..e6cadd90b93 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ "maxmind-db/reader": "1.6.0", "pelago/emogrifier": "^3.1", "woocommerce/action-scheduler": "3.1.6", - "woocommerce/woocommerce-admin": "1.3.0-rc.1", + "woocommerce/woocommerce-admin": "1.3.0-rc.2", "woocommerce/woocommerce-blocks": "2.7.1", "woocommerce/woocommerce-rest-api": "1.0.10" }, diff --git a/composer.lock b/composer.lock index dec7ac99caf..3d5362b36fb 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": "c35209de8f965f88aa5121e3ba76fc65", + "content-hash": "fbf33d1f1bf847639d9871512aaf0158", "packages": [ { "name": "automattic/jetpack-autoloader", @@ -419,16 +419,16 @@ }, { "name": "woocommerce/woocommerce-admin", - "version": "v1.3.0-rc.1", + "version": "v1.3.0-rc.2", "source": { "type": "git", "url": "https://github.com/woocommerce/woocommerce-admin.git", - "reference": "12bc8bf522298a099bb725990cd50bae944e667f" + "reference": "241b8b14a40f1fb426b57747fd72e245a86cd608" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/woocommerce/woocommerce-admin/zipball/12bc8bf522298a099bb725990cd50bae944e667f", - "reference": "12bc8bf522298a099bb725990cd50bae944e667f", + "url": "https://api.github.com/repos/woocommerce/woocommerce-admin/zipball/241b8b14a40f1fb426b57747fd72e245a86cd608", + "reference": "241b8b14a40f1fb426b57747fd72e245a86cd608", "shasum": "" }, "require": { @@ -462,7 +462,7 @@ ], "description": "A modern, javascript-driven WooCommerce Admin experience.", "homepage": "https://github.com/woocommerce/woocommerce-admin", - "time": "2020-06-23T02:57:05+00:00" + "time": "2020-06-25T01:22:20+00:00" }, { "name": "woocommerce/woocommerce-blocks", From 7331036d178ef77ce81218eece126477a243f5d3 Mon Sep 17 00:00:00 2001 From: Christopher Allford Date: Thu, 25 Jun 2020 16:54:17 -0700 Subject: [PATCH 081/100] Moved synchronous webhook execution into a shutdown function One of the problems with synchronous webhooks is that they are executed as soon as the related action is. Since we may call an action multiple times in the process of updating something, this causes only the first action to trigger the hook. This differs from asynchronous execution because in that case, the web hook will be executed after the entire request has completed. --- includes/wc-webhook-functions.php | 29 +++++++++++++++++-- .../legacy/unit-tests/webhooks/functions.php | 23 +++++++++++++++ 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/includes/wc-webhook-functions.php b/includes/wc-webhook-functions.php index 4845889f952..933572520b8 100644 --- a/includes/wc-webhook-functions.php +++ b/includes/wc-webhook-functions.php @@ -8,6 +8,23 @@ defined( 'ABSPATH' ) || exit; +/** + * Process the synchronous web hooks at the end of the request. + * + * @since 4.4.0 + */ +function wc_webhook_execute_synchronous_queue() { + global $wc_queued_sync_webhooks; + if ( empty( $wc_queued_sync_webhooks ) ) { + return; + } + + foreach ( $wc_queued_sync_webhooks as $data ) { + $data['webhook']->deliver( $data['arg'] ); + } +} +register_shutdown_function( 'wc_webhook_execute_synchronous_queue' ); + /** * Process webhook delivery. * @@ -33,8 +50,16 @@ function wc_webhook_process_delivery( $webhook, $arg ) { WC()->queue()->add( 'woocommerce_deliver_webhook_async', $queue_args, 'woocommerce-webhooks' ); } } else { - // Deliver immediately. - $webhook->deliver( $arg ); + // We need to queue the webhook so that it can be ran after the request has finished processing. + // This must be done in order to keep parity with how they are executed asynchronously. + global $wc_queued_sync_webhooks; + if ( ! isset( $wc_queued_sync_webhooks ) ) { + $wc_queued_sync_webhooks = array(); + } + $wc_queued_sync_webhooks[] = array( + 'webhook' => $webhook, + 'arg' => $arg, + ); } } add_action( 'woocommerce_webhook_process_delivery', 'wc_webhook_process_delivery', 10, 2 ); diff --git a/tests/legacy/unit-tests/webhooks/functions.php b/tests/legacy/unit-tests/webhooks/functions.php index ee2cfb220a9..35d418fceeb 100644 --- a/tests/legacy/unit-tests/webhooks/functions.php +++ b/tests/legacy/unit-tests/webhooks/functions.php @@ -238,6 +238,29 @@ class WC_Tests_Webhook_Functions extends WC_Unit_Test_Case { remove_action( 'woocommerce_webhook_process_delivery', array( $this, 'woocommerce_webhook_process_delivery' ), 1, 2 ); } + /** + * Verify that a webhook is queued when intended to be delivered synchronously. This allows us to then execute them + * all in a `register_shutdown_function` after the request has processed. Since async jobs are handled in + * this way, we can be more confident that it is consistent. + */ + public function test_woocommerce_webhook_synchronous_is_queued() { + add_filter( 'woocommerce_webhook_deliver_async', '__return_false' ); + $webhook = wc_get_webhook( $this->create_webhook( 'customer.created' )->get_id() ); + wc_load_webhooks( 'active' ); + add_action( 'woocommerce_webhook_process_delivery', array( $this, 'woocommerce_webhook_process_delivery' ), 1, 2 ); + $customer = WC_Helper_Customer::create_customer( 'test1', 'pw1', 'user1@example.com' ); + + global $wc_queued_sync_webhooks; + $this->assertCount( 1, $wc_queued_sync_webhooks ); + $this->assertEquals( $webhook->get_id(), $wc_queued_sync_webhooks[0]['webhook']->get_id() ); + $this->assertEquals( $customer->get_id(), $wc_queued_sync_webhooks[0]['arg'] ); + + $wc_queued_sync_webhooks = null; + remove_filter( 'woocommerce_webhook_deliver_async', '__return_false' ); + $webhook->delete( true ); + $customer->delete( true ); + } + /** * Helper function to keep track of which webhook (and corresponding arg) has been delivered * within the current request. From 9dcbd48e672b7775e8c6df61527aaeae8275223c Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Fri, 26 Jun 2020 00:48:50 +0000 Subject: [PATCH 082/100] Update dependency autoprefixer to v9.8.4 --- package-lock.json | 72 +++++++++++++++++++++++++++-------------------- package.json | 2 +- 2 files changed, 43 insertions(+), 31 deletions(-) diff --git a/package-lock.json b/package-lock.json index d890ecee0a6..340dd04d9cb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9294,54 +9294,54 @@ "dev": true }, "autoprefixer": { - "version": "9.7.5", - "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-9.7.5.tgz", - "integrity": "sha512-URo6Zvt7VYifomeAfJlMFnYDhow1rk2bufwkbamPEAtQFcL11moLk4PnR7n9vlu7M+BkXAZkHFA0mIcY7tjQFg==", + "version": "9.8.4", + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-9.8.4.tgz", + "integrity": "sha512-84aYfXlpUe45lvmS+HoAWKCkirI/sw4JK0/bTeeqgHYco3dcsOn0NqdejISjptsYwNji/21dnkDri9PsYKk89A==", "dev": true, "requires": { - "browserslist": "^4.11.0", - "caniuse-lite": "^1.0.30001036", - "chalk": "^2.4.2", + "browserslist": "^4.12.0", + "caniuse-lite": "^1.0.30001087", + "colorette": "^1.2.0", "normalize-range": "^0.1.2", "num2fraction": "^1.2.2", - "postcss": "^7.0.27", - "postcss-value-parser": "^4.0.3" + "postcss": "^7.0.32", + "postcss-value-parser": "^4.1.0" }, "dependencies": { "browserslist": { - "version": "4.11.1", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.11.1.tgz", - "integrity": "sha512-DCTr3kDrKEYNw6Jb9HFxVLQNaue8z+0ZfRBRjmCunKDEXEBajKDj2Y+Uelg+Pi29OnvaSGwjOsnRyNEkXzHg5g==", + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.12.1.tgz", + "integrity": "sha512-WMjXwFtPskSW1pQUDJRxvRKRkeCr7usN0O/Za76N+F4oadaTdQHotSGcX9jT/Hs7mSKPkyMFNvqawB/1HzYDKQ==", "dev": true, "requires": { - "caniuse-lite": "^1.0.30001038", - "electron-to-chromium": "^1.3.390", - "node-releases": "^1.1.53", - "pkg-up": "^2.0.0" + "caniuse-lite": "^1.0.30001088", + "electron-to-chromium": "^1.3.481", + "escalade": "^3.0.1", + "node-releases": "^1.1.58" } }, "caniuse-lite": { - "version": "1.0.30001038", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001038.tgz", - "integrity": "sha512-zii9quPo96XfOiRD4TrfYGs+QsGZpb2cGiMAzPjtf/hpFgB6zCPZgJb7I1+EATeMw/o+lG8FyRAnI+CWStHcaQ==", + "version": "1.0.30001088", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001088.tgz", + "integrity": "sha512-6eYUrlShRYveyqKG58HcyOfPgh3zb2xqs7NvT2VVtP3hEUeeWvc3lqhpeMTxYWBBeeaT9A4bKsrtjATm66BTHg==", "dev": true }, "electron-to-chromium": { - "version": "1.3.391", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.391.tgz", - "integrity": "sha512-WOi6loSnDmfICOqGRrgeK7bZeWDAbGjCptDhI5eyJAqSzWfoeRuOOU1rOTZRL29/9AaxTndZB6Uh8YrxRfZJqw==", + "version": "1.3.483", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.483.tgz", + "integrity": "sha512-+05RF8S9rk8S0G8eBCqBRBaRq7+UN3lDs2DAvnG8SBSgQO3hjy0+qt4CmRk5eiuGbTcaicgXfPmBi31a+BD3lg==", "dev": true }, "node-releases": { - "version": "1.1.53", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.53.tgz", - "integrity": "sha512-wp8zyQVwef2hpZ/dJH7SfSrIPD6YoJz6BDQDpGEkcA0s3LpAQoxBIYmfIq6QAhC1DhwsyCgTaTTcONwX8qzCuQ==", + "version": "1.1.58", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.58.tgz", + "integrity": "sha512-NxBudgVKiRh/2aPWMgPR7bPTX0VPmGx5QBwCtdHitnqFE5/O8DeBXuIMH1nwNnw/aMo6AjOrpsHzfY3UbUJ7yg==", "dev": true }, "postcss": { - "version": "7.0.27", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.27.tgz", - "integrity": "sha512-WuQETPMcW9Uf1/22HWUWP9lgsIC+KEHg2kozMflKjbeUtw9ujvFX6QmIfozaErDkmLWS9WEnEdEe6Uo9/BNTdQ==", + "version": "7.0.32", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.32.tgz", + "integrity": "sha512-03eXong5NLnNCD05xscnGKGDZ98CyzoqPSMjOe6SuoQY7Z2hIj0Ld1g/O/UQRuOle2aRtiIRDg9tDcTGAkLfKw==", "dev": true, "requires": { "chalk": "^2.4.2", @@ -9350,9 +9350,9 @@ } }, "postcss-value-parser": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.0.3.tgz", - "integrity": "sha512-N7h4pG+Nnu5BEIzyeaaIYWs0LI5XC40OrRh5L60z0QjFsqGWcHcbkBvpe1WYpcIS9yQ8sOi/vIPt1ejQCrMVrg==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.1.0.tgz", + "integrity": "sha512-97DXOFbQJhk71ne5/Mt6cOu6yxsSfM0QGQyl0L25Gca4yGWEGJaig7l7gbCX623VqTBNGLRLaVUCnNkcedlRSQ==", "dev": true } } @@ -11193,6 +11193,12 @@ "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", "dev": true }, + "colorette": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.2.0.tgz", + "integrity": "sha512-soRSroY+OF/8OdA3PTQXwaDJeMc7TfknKKrxeSCencL2a4+Tx5zhxmmv7hdpCjhKBjehzp8+bwe/T68K0hpIjw==", + "dev": true + }, "colors": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", @@ -13284,6 +13290,12 @@ "es6-promise": "^4.0.3" } }, + "escalade": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.0.1.tgz", + "integrity": "sha512-DR6NO3h9niOT+MZs7bjxlj2a1k+POu5RN8CLTPX2+i78bRi9eLe7+0zXgUHMnGXWybYcL61E9hGhPKqedy8tQA==", + "dev": true + }, "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", diff --git a/package.json b/package.json index b52ca4d7c3a..3b13f5357bb 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "@wordpress/babel-plugin-import-jsx-pragma": "1.1.3", "@wordpress/babel-preset-default": "3.0.2", "@wordpress/e2e-test-utils": "4.6.0", - "autoprefixer": "9.7.5", + "autoprefixer": "9.8.4", "babel-eslint": "10.1.0", "chai": "4.2.0", "chai-as-promised": "7.1.1", From 995cedbcfe93bee6756b4b19afd2d166ae37dfed Mon Sep 17 00:00:00 2001 From: priyankabehera Date: Sat, 27 Jun 2020 17:42:47 +0530 Subject: [PATCH 083/100] Fixed HTML entities in product name not showing correctly in cart page #26780 --- templates/cart/cart.php | 4 ++-- templates/single-product/title.php | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/templates/cart/cart.php b/templates/cart/cart.php index 8a9c11f6139..a210deaa14d 100644 --- a/templates/cart/cart.php +++ b/templates/cart/cart.php @@ -74,9 +74,9 @@ do_action( 'woocommerce_before_cart' ); ?> get_name(), $cart_item, $cart_item_key ) . ' ' ); + echo wp_kses_post( apply_filters( 'woocommerce_cart_item_name', esc_html( $_product->get_name() ), $cart_item, $cart_item_key ) . ' ' ); } else { - echo wp_kses_post( apply_filters( 'woocommerce_cart_item_name', sprintf( '%s', esc_url( $product_permalink ), $_product->get_name() ), $cart_item, $cart_item_key ) ); + echo wp_kses_post( apply_filters( 'woocommerce_cart_item_name', sprintf( '%s', esc_url( $product_permalink ), esc_html( $_product->get_name() ) ), $cart_item, $cart_item_key ) ); } do_action( 'woocommerce_after_cart_item_name', $cart_item, $cart_item_key ); diff --git a/templates/single-product/title.php b/templates/single-product/title.php index f117c11089d..6929a4cae80 100644 --- a/templates/single-product/title.php +++ b/templates/single-product/title.php @@ -19,4 +19,7 @@ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } -the_title( '

', '

' ); +?> +

+ +

\ No newline at end of file From 9aa3c54bd9a74b9206d69edfea6cf737aa78dbe6 Mon Sep 17 00:00:00 2001 From: Nestor Soriano Date: Wed, 27 May 2020 11:53:16 +0200 Subject: [PATCH 084/100] Fix variable product stock status not being properly set on save When a product is saved its validate_props method is invoked, and this recalculates the stock_status property based on whether the product manages stock or not, the stock quantity, and the value of the woocommerce_notify_no_stock_amount option. In the case of variable products, and when stock is managed, the stock was set to "instock" when the current stock was enough, but only if the "stock_quantity" property was in the list of changed properties for the object (the method in the base product class doen't check for changed properties). This is a problem because the wc_update_product_stock function updates stock_quantity but via direct database modification, and thus stock_quantity isn't considered modified. Therefore stock modifications via wc_update_product_stock don't update stock_status on the product (e.g. when going from 0 to 1 after a refund the stock status will remain as "outofstock"). The fix consists of removing the check for changed properties since it's not done anyway in the other cases (when stock is below the woocommerce_notify_no_stock_amount threshold) nor in the base class. Also, validate_props is refactored for readabiliyy, and an useless set_stock_status() call placed right before save() in wc_update_product_stock is removed. --- includes/abstracts/abstract-wc-product.php | 26 +++++----- includes/class-wc-product-variable.php | 22 +------- includes/wc-stock-functions.php | 1 - .../product/class-wc-tests-product.php | 50 ++++++++++++++++-- .../unit-tests/product/product-variable.php | 51 +++++++++++++++++-- 5 files changed, 110 insertions(+), 40 deletions(-) diff --git a/includes/abstracts/abstract-wc-product.php b/includes/abstracts/abstract-wc-product.php index aa3d28c9ed0..d7c04330b04 100644 --- a/includes/abstracts/abstract-wc-product.php +++ b/includes/abstracts/abstract-wc-product.php @@ -1336,19 +1336,21 @@ class WC_Product extends WC_Abstract_Legacy_Product { $this->set_stock_quantity( '' ); $this->set_backorders( 'no' ); $this->set_low_stock_amount( '' ); - - // If we are stock managing and we don't have stock, force out of stock status. - } elseif ( $this->get_stock_quantity() <= get_option( 'woocommerce_notify_no_stock_amount', 0 ) && 'no' === $this->get_backorders() ) { - $this->set_stock_status( 'outofstock' ); - - // If we are stock managing, backorders are allowed, and we don't have stock, force on backorder status. - } elseif ( $this->get_stock_quantity() <= get_option( 'woocommerce_notify_no_stock_amount', 0 ) && 'no' !== $this->get_backorders() ) { - $this->set_stock_status( 'onbackorder' ); - - // If the stock level is changing and we do now have enough, force in stock status. - } elseif ( $this->get_stock_quantity() > get_option( 'woocommerce_notify_no_stock_amount', 0 ) ) { - $this->set_stock_status( 'instock' ); + return; } + + $stock_is_above_notification_threshold = ( $this->get_stock_quantity() > get_option( 'woocommerce_notify_no_stock_amount', 0 ) ); + $backorders_are_allowed = ( 'no' !== $this->get_backorders() ); + + if ( $stock_is_above_notification_threshold ) { + $new_stock_status = 'instock'; + } elseif ( $backorders_are_allowed ) { + $new_stock_status = 'onbackorder'; + } else { + $new_stock_status = 'outofstock'; + } + + $this->set_stock_status( $new_stock_status ); } /** diff --git a/includes/class-wc-product-variable.php b/includes/class-wc-product-variable.php index 1cd8ddc52cf..a5e30961bcf 100644 --- a/includes/class-wc-product-variable.php +++ b/includes/class-wc-product-variable.php @@ -413,28 +413,10 @@ class WC_Product_Variable extends WC_Product { * @since 3.0.0 */ public function validate_props() { - // Before updating, ensure stock props are all aligned. Qty and backorders are not needed if not stock managed. + parent::validate_props(); + if ( ! $this->get_manage_stock() ) { - $this->set_stock_quantity( '' ); - $this->set_backorders( 'no' ); - $this->set_low_stock_amount( '' ); $this->data_store->sync_stock_status( $this ); - - // If we are stock managing, backorders are allowed, and we don't have stock, force on backorder status. - } elseif ( $this->get_stock_quantity() <= get_option( 'woocommerce_notify_no_stock_amount', 0 ) && 'no' !== $this->get_backorders() ) { - $this->set_stock_status( 'onbackorder' ); - - // If we are stock managing and we don't have stock, force out of stock status. - } elseif ( $this->get_stock_quantity() <= get_option( 'woocommerce_notify_no_stock_amount', 0 ) && 'no' === $this->get_backorders() ) { - $this->set_stock_status( 'outofstock' ); - - // If the stock level is changing and we do now have enough, force in stock status. - } elseif ( $this->get_stock_quantity() > get_option( 'woocommerce_notify_no_stock_amount', 0 ) && array_key_exists( 'stock_quantity', $this->get_changes() ) ) { - $this->set_stock_status( 'instock' ); - - // Otherwise revert to status the children have. - } else { - $this->set_stock_status( $this->child_is_in_stock() ? 'instock' : 'outofstock' ); } } diff --git a/includes/wc-stock-functions.php b/includes/wc-stock-functions.php index d39065cd3d1..d91f1cacfb7 100644 --- a/includes/wc-stock-functions.php +++ b/includes/wc-stock-functions.php @@ -46,7 +46,6 @@ function wc_update_product_stock( $product, $stock_quantity = null, $operation = // If this is not being called during an update routine, save the product so stock status etc is in sync, and caches are cleared. if ( ! $updating ) { - $product_with_stock->set_stock_status(); $product_with_stock->save(); } diff --git a/tests/legacy/unit-tests/product/class-wc-tests-product.php b/tests/legacy/unit-tests/product/class-wc-tests-product.php index 7bed4d974ec..557ef784a50 100644 --- a/tests/legacy/unit-tests/product/class-wc-tests-product.php +++ b/tests/legacy/unit-tests/product/class-wc-tests-product.php @@ -12,6 +12,22 @@ */ class WC_Tests_Product extends WC_Unit_Test_Case { + /** + * @var WC_Product + */ + protected $product; + + /** + * Runs before every test. + */ + public function setUp() { + parent::setUp(); + + $this->product = new WC_Product(); + $this->product->save(); + } + + /** * @testdox When a product is saved or deleted its parent should be scheduled for sync at the end of the request. * @@ -23,19 +39,45 @@ class WC_Tests_Product extends WC_Unit_Test_Case { public function test_deferred_sync_on_save_and_delete( $operation ) { $defer_sync_invoked = false; - $defer_product_callback = function() use ( &$defer_sync_invoked ) { + $defer_product_callback = function () use ( &$defer_sync_invoked ) { $defer_sync_invoked = true; }; $product = $this->getMockBuilder( WC_Product::class ) - ->setMethods( array( 'maybe_defer_product_sync' ) ) - ->getMock(); + ->setMethods( array( 'maybe_defer_product_sync' ) ) + ->getMock(); $product->method( 'maybe_defer_product_sync' ) - ->will( $this->returnCallback( $defer_product_callback ) ); + ->will( $this->returnCallback( $defer_product_callback ) ); $product->$operation(); $this->assertTrue( $defer_sync_invoked ); } + + /** + * @testdox Test that stock status is set to the proper value when saving, if the product manages stock levels. + * + * @testWith [5, 4, true, "instock"] + * [5, 4, false, "instock"] + * [4, 4, true, "onbackorder"] + * [4, 4, false, "outofstock"] + * [3, 4, true, "onbackorder"] + * [3, 4, false, "outofstock"] + * + * @param int $stock_quantity Current stock quantity for the product. + * @param bool $notify_no_stock_amount Value for the woocommerce_notify_no_stock_amount option. + * @param bool $accepts_backorders Whether the product accepts backorders or not. + * @param string $expected_stock_status The expected stock status of the product after being saved. + */ + public function test_stock_status_on_save_when_managing_stock( $stock_quantity, $notify_no_stock_amount, $accepts_backorders, $expected_stock_status ) { + update_option( 'woocommerce_notify_no_stock_amount', $notify_no_stock_amount ); + $this->product->set_backorders( $accepts_backorders ? 'yes' : 'no' ); + $this->product->set_manage_stock( 'yes' ); + $this->product->set_stock_status( '' ); + $this->product->set_stock_quantity( $stock_quantity ); + $this->product->save(); + + $this->assertEquals( $expected_stock_status, $this->product->get_stock_status() ); + } } diff --git a/tests/legacy/unit-tests/product/product-variable.php b/tests/legacy/unit-tests/product/product-variable.php index 68b6bf5d542..044f147375b 100644 --- a/tests/legacy/unit-tests/product/product-variable.php +++ b/tests/legacy/unit-tests/product/product-variable.php @@ -76,11 +76,11 @@ class WC_Tests_Product_Variable extends WC_Unit_Test_Case { } /** - * Test that variable products have the correct status when syncing with their children. + * Create a variable product with two variations. * - * @since 3.3.0 + * @return array An array containing first the main product, and then the two variation products. */ - public function test_variable_product_stock_status_sync() { + private function get_variable_product_with_children() { $product = new WC_Product_Variable(); $product->save(); @@ -94,6 +94,17 @@ class WC_Tests_Product_Variable extends WC_Unit_Test_Case { $product->set_children( array( $child1->get_id(), $child2->get_id() ) ); + return array( $product, $child1, $child2 ); + } + + /** + * Test that variable products have the correct status when syncing with their children. + * + * @since 3.3.0 + */ + public function test_variable_product_stock_status_sync() { + list($product, $child1, $child2) = $this->get_variable_product_with_children(); + // Product should be in stock if a child is in stock. $child1->set_stock_status( 'instock' ); $child1->save(); @@ -131,4 +142,38 @@ class WC_Tests_Product_Variable extends WC_Unit_Test_Case { WC_Product_Variable::sync( $product ); $this->assertEquals( 'onbackorder', $product->get_stock_status() ); } + + /** + * @testdox Test that stock status is set to the proper value when saving, if the product manages stock levels. + * + * @testWith [5, 4, true, "instock"] + * [5, 4, false, "instock"] + * [4, 4, true, "onbackorder"] + * [4, 4, false, "outofstock"] + * [3, 4, true, "onbackorder"] + * [3, 4, false, "outofstock"] + * + * @param int $stock_quantity Current stock quantity for the product. + * @param bool $notify_no_stock_amount Value for the woocommerce_notify_no_stock_amount option. + * @param bool $accepts_backorders Whether the product accepts backorders or not. + * @param string $expected_stock_status The expected stock status of the product after being saved. + */ + public function test_stock_status_on_save_when_managing_stock( $stock_quantity, $notify_no_stock_amount, $accepts_backorders, $expected_stock_status ) { + list($product, $child1, $child2) = $this->get_variable_product_with_children(); + + update_option( 'woocommerce_notify_no_stock_amount', $notify_no_stock_amount ); + + $child1->set_stock_status( '' ); + $child1->save(); + $child2->set_stock_status( '' ); + $child2->save(); + + $product->set_manage_stock( 'yes' ); + $product->set_stock_status( '' ); + $product->set_backorders( $accepts_backorders ? 'yes' : 'no' ); + $product->set_stock_quantity( $stock_quantity ); + $product->save(); + + $this->assertEquals( $expected_stock_status, $product->get_stock_status() ); + } } From 391474c5efde604170b3568accf17ad84d9c6d64 Mon Sep 17 00:00:00 2001 From: Nestor Soriano Date: Mon, 29 Jun 2020 15:20:49 +0200 Subject: [PATCH 085/100] Fix code sniffer errors in class-wc-tests-product.php --- tests/legacy/unit-tests/product/class-wc-tests-product.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/legacy/unit-tests/product/class-wc-tests-product.php b/tests/legacy/unit-tests/product/class-wc-tests-product.php index 557ef784a50..182f238cd1d 100644 --- a/tests/legacy/unit-tests/product/class-wc-tests-product.php +++ b/tests/legacy/unit-tests/product/class-wc-tests-product.php @@ -44,11 +44,11 @@ class WC_Tests_Product extends WC_Unit_Test_Case { }; $product = $this->getMockBuilder( WC_Product::class ) - ->setMethods( array( 'maybe_defer_product_sync' ) ) - ->getMock(); + ->setMethods( array( 'maybe_defer_product_sync' ) ) + ->getMock(); $product->method( 'maybe_defer_product_sync' ) - ->will( $this->returnCallback( $defer_product_callback ) ); + ->will( $this->returnCallback( $defer_product_callback ) ); $product->$operation(); From 8b8cccf4025cc6996a66d5643f1e19f64f569d82 Mon Sep 17 00:00:00 2001 From: imwatsi <31913074+imwatsi@users.noreply.github.com> Date: Mon, 29 Jun 2020 22:07:31 +0200 Subject: [PATCH 086/100] Add Namibia regions --- i18n/states.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/i18n/states.php b/i18n/states.php index 9c2a5ff6876..df189a7ae7d 100644 --- a/i18n/states.php +++ b/i18n/states.php @@ -909,6 +909,22 @@ return array( 'MZT' => __( 'Tete', 'woocommerce' ), 'MZQ' => __( 'Zambézia', 'woocommerce' ), ), + 'NA' => array( // Namibia regions. + 'ER' => __( 'Erongo', 'woocommerce' ), + 'HA' => __( 'Hardap', 'woocommerce' ), + 'KA' => __( 'Karas', 'woocommerce' ), + 'KE' => __( 'Kavango East', 'woocommerce' ), + 'KW' => __( 'Kavanga West', 'woocommerce' ), + 'KH' => __( 'Khomas', 'woocommerce' ), + 'KU' => __( 'Kunene', 'woocommerce' ), + 'OW' => __( 'Ohangwena', 'woocommerce' ), + 'OH' => __( 'Omaheke', 'woocommerce' ), + 'OS' => __( 'Omusati', 'woocommerce' ), + 'ON' => __( 'Oshana', 'woocommerce' ), + 'OT' => __( 'Oshikoto', 'woocommerce' ), + 'OD' => __( 'Otjozondjupa', 'woocommerce' ), + 'CA' => __( 'Zambezi', 'woocommerce' ), + ), 'NG' => array( // Nigerian provinces. 'AB' => __( 'Abia', 'woocommerce' ), 'FC' => __( 'Abuja', 'woocommerce' ), From 701490b13ee73665f0c4d4611715a1b4d9c53346 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Tue, 30 Jun 2020 13:05:56 -0300 Subject: [PATCH 087/100] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Néstor Soriano --- includes/legacy/class-wc-legacy-cart.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/legacy/class-wc-legacy-cart.php b/includes/legacy/class-wc-legacy-cart.php index 2dee8c452b5..2fbb624041b 100644 --- a/includes/legacy/class-wc-legacy-cart.php +++ b/includes/legacy/class-wc-legacy-cart.php @@ -63,10 +63,10 @@ abstract class WC_Legacy_Cart { 'tax_display_cart', 'fees', ), - array_keys( $this->cart_session_data ) + is_array( $this->cart_session_data ) ? array_keys( $this->cart_session_data ) : array() ); - if ( in_array( $key, $legacy_keys, true ) ) { + if ( in_array( $name, $legacy_keys, true ) ) { return true; } From 54a94152ecff4afe943f4cb58a6b014cc75c6c35 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Tue, 30 Jun 2020 13:25:30 -0300 Subject: [PATCH 088/100] Map all deprecated keys in __isset() --- includes/legacy/class-wc-legacy-cart.php | 26 +++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/includes/legacy/class-wc-legacy-cart.php b/includes/legacy/class-wc-legacy-cart.php index 2fbb624041b..89d46695f9b 100644 --- a/includes/legacy/class-wc-legacy-cart.php +++ b/includes/legacy/class-wc-legacy-cart.php @@ -60,8 +60,32 @@ abstract class WC_Legacy_Cart { public function __isset( $name ) { $legacy_keys = array_merge( array( - 'tax_display_cart', + 'dp', + 'prices_include_tax', + 'round_at_subtotal', + 'cart_contents_total', + 'total', + 'subtotal', + 'subtotal_ex_tax', + 'tax_total', + 'fee_total', + 'discount_cart', + 'discount_cart_tax', + 'shipping_total', + 'shipping_tax_total', + 'display_totals_ex_tax', + 'display_cart_ex_tax', + 'cart_contents_weight', + 'cart_contents_count', + 'coupons', + 'taxes', + 'shipping_taxes', + 'coupon_discount_amounts', + 'coupon_discount_tax_amounts', 'fees', + 'tax', + 'discount_total', + 'tax_display_cart', ), is_array( $this->cart_session_data ) ? array_keys( $this->cart_session_data ) : array() ); From 0de1d4f9c03cbfe2f15d29ae62fa2366585799b9 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Tue, 30 Jun 2020 13:32:11 -0300 Subject: [PATCH 089/100] Updated docblock --- includes/legacy/class-wc-legacy-cart.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/includes/legacy/class-wc-legacy-cart.php b/includes/legacy/class-wc-legacy-cart.php index 89d46695f9b..22c665ff884 100644 --- a/includes/legacy/class-wc-legacy-cart.php +++ b/includes/legacy/class-wc-legacy-cart.php @@ -100,6 +100,8 @@ abstract class WC_Legacy_Cart { /** * Magic getters. * + * If you add/remove cases here please update $legacy_keys in __isset accordingly. + * * @param string $name Property name. * @return mixed */ From 15800b0e0b855f6fb5f0266a05d4b07aae1a2042 Mon Sep 17 00:00:00 2001 From: Ron Rennick Date: Tue, 30 Jun 2020 16:32:33 -0300 Subject: [PATCH 090/100] add package build to build script --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3b13f5357bb..1dfb1eb9218 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "license": "GPL-3.0+", "main": "Gruntfile.js", "scripts": { - "build": "grunt && npm run makepot", + "build": "grunt && npm run makepot && npm run build:packages", "build-watch": "grunt watch", "build:packages": "node ./tests/e2e/bin/build.js", "build:zip": "./bin/build-zip.sh", From 5cda3967ff63aab8d519236e7414daa963952e30 Mon Sep 17 00:00:00 2001 From: Alamgir Date: Wed, 1 Jul 2020 10:14:22 +0600 Subject: [PATCH 091/100] Fix - wrong capabilites use on add order note issue fixed --- includes/class-wc-order.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class-wc-order.php b/includes/class-wc-order.php index a43455d2fcb..e988368c50c 100644 --- a/includes/class-wc-order.php +++ b/includes/class-wc-order.php @@ -1688,7 +1688,7 @@ class WC_Order extends WC_Abstract_Order { return 0; } - if ( is_user_logged_in() && current_user_can( 'edit_shop_order', $this->get_id() ) && $added_by_user ) { + if ( is_user_logged_in() && current_user_can( 'edit_shop_orders', $this->get_id() ) && $added_by_user ) { $user = get_user_by( 'id', get_current_user_id() ); $comment_author = $user->display_name; $comment_author_email = $user->user_email; From 61caec9a24e8bba5d0917b22e7b9b8daadcf739e Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Wed, 1 Jul 2020 13:00:25 -0300 Subject: [PATCH 092/100] Fixed coding standards --- assets/js/admin/wc-product-import.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/js/admin/wc-product-import.js b/assets/js/admin/wc-product-import.js index 08d2e89aa79..645f11b5912 100644 --- a/assets/js/admin/wc-product-import.js +++ b/assets/js/admin/wc-product-import.js @@ -69,7 +69,7 @@ '&products-skipped=' + parseInt( $this.skipped, 10 ) + '&file-name=' + - file_name; + file_name; } else { $this.run_import(); } From 5db9afca28e300f98ae0379fe912a7f4540a1ebd Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Wed, 1 Jul 2020 14:16:10 -0300 Subject: [PATCH 093/100] Bump template version --- templates/cart/cross-sells.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/cart/cross-sells.php b/templates/cart/cross-sells.php index fdc5c02fb0b..1312c5242df 100644 --- a/templates/cart/cross-sells.php +++ b/templates/cart/cross-sells.php @@ -12,7 +12,7 @@ * * @see https://docs.woocommerce.com/document/template-structure/ * @package WooCommerce/Templates - * @version 3.0.0 + * @version 4.4.0 */ defined( 'ABSPATH' ) || exit; From 101a8ae243fbf9da0da28ecf0f09e38fb1f1a8f2 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Wed, 1 Jul 2020 14:36:22 -0300 Subject: [PATCH 094/100] Added context --- includes/class-wc-post-types.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/includes/class-wc-post-types.php b/includes/class-wc-post-types.php index c382f13c7b5..ba118626fda 100644 --- a/includes/class-wc-post-types.php +++ b/includes/class-wc-post-types.php @@ -519,19 +519,19 @@ class WC_Post_Types { $label = ! empty( $tax->attribute_label ) ? $tax->attribute_label : $tax->attribute_name; $messages[ $name ] = array( - 0 => '', + 0 => '' /* translators: %s: taxonomy label */ - 1 => sprintf( __( '%s added', 'woocommerce' ), $label ), + 1 => sprintf( _x( '%s added', 'taxonomy term messages', 'woocommerce' ), $label ), /* translators: %s: taxonomy label */ - 2 => sprintf( __( '%s deleted', 'woocommerce' ), $label ), + 2 => sprintf( _x( '%s deleted', 'taxonomy term messages', 'woocommerce' ), $label ), /* translators: %s: taxonomy label */ - 3 => sprintf( __( '%s updated', 'woocommerce' ), $label ), + 3 => sprintf( _x( '%s updated', 'taxonomy term messages', 'woocommerce' ), $label ), /* translators: %s: taxonomy label */ - 4 => sprintf( __( '%s not added', 'woocommerce' ), $label ), + 4 => sprintf( _x( '%s not added', 'taxonomy term messages', 'woocommerce' ), $label ), /* translators: %s: taxonomy label */ - 5 => sprintf( __( '%s not updated', 'woocommerce' ), $label ), + 5 => sprintf( _x( '%s not updated', 'taxonomy term messages', 'woocommerce' ), $label ), /* translators: %s: taxonomy label */ - 6 => sprintf( __( '%s not deleted', 'woocommerce' ), $label ), + 6 => sprintf( _x( '%s not deleted', 'taxonomy term messages', 'woocommerce' ), $label ), ); } } From b813c620ccbd28e860d2e8ea8355b378d4377554 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Wed, 1 Jul 2020 15:10:16 -0300 Subject: [PATCH 095/100] Fixed typo --- i18n/states.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i18n/states.php b/i18n/states.php index df189a7ae7d..ae613562d73 100644 --- a/i18n/states.php +++ b/i18n/states.php @@ -914,7 +914,7 @@ return array( 'HA' => __( 'Hardap', 'woocommerce' ), 'KA' => __( 'Karas', 'woocommerce' ), 'KE' => __( 'Kavango East', 'woocommerce' ), - 'KW' => __( 'Kavanga West', 'woocommerce' ), + 'KW' => __( 'Kavango West', 'woocommerce' ), 'KH' => __( 'Khomas', 'woocommerce' ), 'KU' => __( 'Kunene', 'woocommerce' ), 'OW' => __( 'Ohangwena', 'woocommerce' ), From bdf996eec870be788e016a99c44abf21d7406b78 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Wed, 1 Jul 2020 17:39:49 -0300 Subject: [PATCH 096/100] Fixed use of esc_html() and bumped the template version Also fixed some coding standards --- templates/single-product/title.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/templates/single-product/title.php b/templates/single-product/title.php index 6929a4cae80..52af1121410 100644 --- a/templates/single-product/title.php +++ b/templates/single-product/title.php @@ -10,9 +10,9 @@ * 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/ - * @package WooCommerce/Templates - * @version 1.6.4 + * @see https://docs.woocommerce.com/document/template-structure/ + * @package WooCommerce\Templates + * @version 4.4.0 */ if ( ! defined( 'ABSPATH' ) ) { @@ -21,5 +21,5 @@ if ( ! defined( 'ABSPATH' ) ) { ?>

- -

\ No newline at end of file + + From ee2087a7d365c4df9d9a07386399e1e6cb70d149 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Wed, 1 Jul 2020 17:42:33 -0300 Subject: [PATCH 097/100] Updated template version --- templates/cart/cart.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/cart/cart.php b/templates/cart/cart.php index a210deaa14d..414e61ff8df 100644 --- a/templates/cart/cart.php +++ b/templates/cart/cart.php @@ -11,8 +11,8 @@ * the readme will list any important changes. * * @see https://docs.woocommerce.com/document/template-structure/ - * @package WooCommerce/Templates - * @version 3.5.0 + * @package WooCommerce\Templates + * @version 4.4.0 */ defined( 'ABSPATH' ) || exit; From e20a69c35cbfb44a7268ac2bc4610dcbdba94e89 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Wed, 1 Jul 2020 17:56:19 -0300 Subject: [PATCH 098/100] Fixed missing comma --- includes/class-wc-post-types.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class-wc-post-types.php b/includes/class-wc-post-types.php index bba0a92b773..a792beaa293 100644 --- a/includes/class-wc-post-types.php +++ b/includes/class-wc-post-types.php @@ -521,7 +521,7 @@ class WC_Post_Types { $label = ! empty( $tax->attribute_label ) ? $tax->attribute_label : $tax->attribute_name; $messages[ $name ] = array( - 0 => '' + 0 => '', /* translators: %s: taxonomy label */ 1 => sprintf( _x( '%s added', 'taxonomy term messages', 'woocommerce' ), $label ), /* translators: %s: taxonomy label */ From d3d8e74b586d49472a752bb4d53d6527a928dee5 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Wed, 1 Jul 2020 18:13:29 -0300 Subject: [PATCH 099/100] Fixed unit tests for #26462 --- tests/legacy/unit-tests/cart/cart.php | 6 ++-- .../unit-tests/formatting/functions.php | 28 +++++++++---------- .../order/class-wc-tests-crud-orders.php | 2 +- tests/legacy/unit-tests/product/data.php | 6 ++-- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/tests/legacy/unit-tests/cart/cart.php b/tests/legacy/unit-tests/cart/cart.php index ccfe0074fdf..8c54669d7df 100644 --- a/tests/legacy/unit-tests/cart/cart.php +++ b/tests/legacy/unit-tests/cart/cart.php @@ -1098,7 +1098,7 @@ class WC_Tests_Cart extends WC_Unit_Test_Case { WC()->cart->add_to_cart( $product2->get_id(), 1 ); WC()->cart->calculate_totals(); - $expected_price = '68,50'; + $expected_price = '68,50'; $this->assertEquals( $expected_price, WC()->cart->get_total() ); $this->assertEquals( '12.36', wc_round_tax_total( WC()->cart->get_total_tax( 'edit' ) ) ); @@ -1107,7 +1107,7 @@ class WC_Tests_Cart extends WC_Unit_Test_Case { WC()->cart->add_to_cart( $product4->get_id(), 1 ); WC()->cart->calculate_totals(); - $expected_price = '112,00'; + $expected_price = '112,00'; $this->assertEquals( $expected_price, WC()->cart->get_total() ); $this->assertEquals( '20.19', wc_round_tax_total( WC()->cart->get_total_tax( 'edit' ) ) ); @@ -1118,7 +1118,7 @@ class WC_Tests_Cart extends WC_Unit_Test_Case { WC()->cart->add_to_cart( $product6->get_id(), 1 ); WC()->cart->calculate_totals(); - $expected_price = '239,00'; + $expected_price = '239,00'; $this->assertEquals( $expected_price, WC()->cart->get_total() ); $this->assertEquals( '43.09', wc_round_tax_total( WC()->cart->get_total_tax( 'edit' ) ) ); } diff --git a/tests/legacy/unit-tests/formatting/functions.php b/tests/legacy/unit-tests/formatting/functions.php index 10c52e4fa2c..aa071eeb685 100644 --- a/tests/legacy/unit-tests/formatting/functions.php +++ b/tests/legacy/unit-tests/formatting/functions.php @@ -593,32 +593,32 @@ class WC_Tests_Formatting_Functions extends WC_Unit_Test_Case { */ public function test_wc_price() { // Common prices. - $this->assertEquals( '£1.00', wc_price( 1 ) ); - $this->assertEquals( '£1.10', wc_price( 1.1 ) ); - $this->assertEquals( '£1.17', wc_price( 1.17 ) ); - $this->assertEquals( '£1,111.17', wc_price( 1111.17 ) ); - $this->assertEquals( '£0.00', wc_price( 0 ) ); + $this->assertEquals( '£1.00', wc_price( 1 ) ); + $this->assertEquals( '£1.10', wc_price( 1.1 ) ); + $this->assertEquals( '£1.17', wc_price( 1.17 ) ); + $this->assertEquals( '£1,111.17', wc_price( 1111.17 ) ); + $this->assertEquals( '£0.00', wc_price( 0 ) ); // Different currency. - $this->assertEquals( '$1,111.17', wc_price( 1111.17, array( 'currency' => 'USD' ) ) ); + $this->assertEquals( '$1,111.17', wc_price( 1111.17, array( 'currency' => 'USD' ) ) ); // Negative price. - $this->assertEquals( '-£1.17', wc_price( -1.17 ) ); + $this->assertEquals( '-£1.17', wc_price( -1.17 ) ); // Bogus prices. - $this->assertEquals( '£0.00', wc_price( null ) ); - $this->assertEquals( '£0.00', wc_price( 'Q' ) ); - $this->assertEquals( '£0.00', wc_price( 'ಠ_ಠ' ) ); + $this->assertEquals( '£0.00', wc_price( null ) ); + $this->assertEquals( '£0.00', wc_price( 'Q' ) ); + $this->assertEquals( '£0.00', wc_price( 'ಠ_ಠ' ) ); // Trim zeros. add_filter( 'woocommerce_price_trim_zeros', '__return_true' ); - $this->assertEquals( '£1', wc_price( 1.00 ) ); + $this->assertEquals( '£1', wc_price( 1.00 ) ); remove_filter( 'woocommerce_price_trim_zeros', '__return_true' ); // Ex tax label. $calc_taxes = get_option( 'woocommerce_calc_taxes' ); update_option( 'woocommerce_calc_taxes', 'yes' ); - $this->assertEquals( '£1,111.17 (ex. VAT)', wc_price( '1111.17', array( 'ex_tax_label' => true ) ) ); + $this->assertEquals( '£1,111.17 (ex. VAT)', wc_price( '1111.17', array( 'ex_tax_label' => true ) ) ); update_option( 'woocommerce_calc_taxes', $calc_taxes ); } @@ -926,7 +926,7 @@ class WC_Tests_Formatting_Functions extends WC_Unit_Test_Case { * @since 3.3.0 */ public function test_wc_format_sale_price() { - $this->assertEquals( '£10.00 £5.00', wc_format_sale_price( '10', '5' ) ); + $this->assertEquals( '£10.00 £5.00', wc_format_sale_price( '10', '5' ) ); } /** @@ -935,7 +935,7 @@ class WC_Tests_Formatting_Functions extends WC_Unit_Test_Case { * @since 3.3.0 */ public function test_wc_format_price_range() { - $this->assertEquals( '£10.00£5.00', wc_format_price_range( '10', '5' ) ); + $this->assertEquals( '£10.00£5.00', wc_format_price_range( '10', '5' ) ); } /** diff --git a/tests/legacy/unit-tests/order/class-wc-tests-crud-orders.php b/tests/legacy/unit-tests/order/class-wc-tests-crud-orders.php index 14d466cb62a..190f4257c19 100644 --- a/tests/legacy/unit-tests/order/class-wc-tests-crud-orders.php +++ b/tests/legacy/unit-tests/order/class-wc-tests-crud-orders.php @@ -941,7 +941,7 @@ class WC_Tests_CRUD_Orders extends WC_Unit_Test_Case { $object = new WC_Order(); $object->set_total( 100 ); $object->set_currency( 'USD' ); - $this->assertEquals( '$100.00', $object->get_formatted_order_total() ); + $this->assertEquals( '$100.00', $object->get_formatted_order_total() ); } /** diff --git a/tests/legacy/unit-tests/product/data.php b/tests/legacy/unit-tests/product/data.php index 48aa3e91dd9..bcc5bd583fc 100644 --- a/tests/legacy/unit-tests/product/data.php +++ b/tests/legacy/unit-tests/product/data.php @@ -259,15 +259,15 @@ class WC_Tests_Product_Data extends WC_Unit_Test_Case { $product = wc_get_product( $product1_id ); $this->assertEquals( $product1_id, $product->get_id() ); - $this->assertEquals( '£10.00 £7.00', $product->get_price_html() ); + $this->assertEquals( '£10.00 £7.00', $product->get_price_html() ); $product = wc_get_product( $product2_id ); $this->assertEquals( $product2_id, $product->get_id() ); - $this->assertEquals( '£20.00 £16.00', $product->get_price_html() ); + $this->assertEquals( '£20.00 £16.00', $product->get_price_html() ); $product = wc_get_product( $product3_id ); $this->assertEquals( $product3_id, $product->get_id() ); - $this->assertEquals( '£50.00', $product->get_price_html() ); + $this->assertEquals( '£50.00', $product->get_price_html() ); } /** From 0d9b6786fd12b673154110585680fdb9d3bc444d Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Wed, 1 Jul 2020 18:24:47 -0300 Subject: [PATCH 100/100] [Tracker] Added order_total to orders_edit_status_change --- includes/tracks/events/class-wc-orders-tracking.php | 1 + 1 file changed, 1 insertion(+) diff --git a/includes/tracks/events/class-wc-orders-tracking.php b/includes/tracks/events/class-wc-orders-tracking.php index 7ef2db2a4e8..a889074cca8 100644 --- a/includes/tracks/events/class-wc-orders-tracking.php +++ b/includes/tracks/events/class-wc-orders-tracking.php @@ -80,6 +80,7 @@ class WC_Orders_Tracking { 'previous_status' => $previous_status, 'date_created' => $order->get_date_created() ? $order->get_date_created()->date( 'Y-m-d' ) : '', 'payment_method' => $order->get_payment_method(), + 'order_total' => $order->get_total(), ); WC_Tracks::record_event( 'orders_edit_status_change', $properties );