From cb693a5ccdfcc97a24062660ad5adfe0f2a5b656 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Fri, 29 Jun 2018 13:58:47 +0100 Subject: [PATCH 001/366] Make form aware publish was pressed --- assets/js/admin/meta-boxes-product-variation.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/js/admin/meta-boxes-product-variation.js b/assets/js/admin/meta-boxes-product-variation.js index 560a868ede4..e1e7fcf8e12 100644 --- a/assets/js/admin/meta-boxes-product-variation.js +++ b/assets/js/admin/meta-boxes-product-variation.js @@ -524,7 +524,7 @@ jQuery( function( $ ) { * After saved, continue with form submission */ save_on_submit_done: function() { - $( 'form#post' ).submit(); + $( 'form#post' ).append('').submit(); }, /** From a3c826c1e4b42314a7a1fff8b3980134aaf99df9 Mon Sep 17 00:00:00 2001 From: Chunkford Date: Tue, 7 Aug 2018 22:39:05 +0100 Subject: [PATCH 002/366] Giving the ability to add custom price data I need a way to add my own pricing data to the variation data store, so I can check which price to display on the product and category pages, So instead of adding unnecessary load by leading each variation object to extract the data and meta I need, this gives me a way to get the data through the data store which in turns uses transients instead. --- ...ass-wc-product-variable-data-store-cpt.php | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/includes/data-stores/class-wc-product-variable-data-store-cpt.php b/includes/data-stores/class-wc-product-variable-data-store-cpt.php index 91e19171492..75e38571026 100644 --- a/includes/data-stores/class-wc-product-variable-data-store-cpt.php +++ b/includes/data-stores/class-wc-product-variable-data-store-cpt.php @@ -260,9 +260,11 @@ class WC_Product_Variable_Data_Store_CPT extends WC_Product_Data_Store_CPT imple // If the prices are not stored for this hash, generate them and add to the transient. if ( empty( $transient_cached_prices_array[ $price_hash ] ) ) { - $prices = array(); - $regular_prices = array(); - $sale_prices = array(); + $prices_array = array( + 'price' => array(), + 'regular_price' => array(), + 'sale_price' => array(), + ); $variation_ids = $product->get_visible_children(); foreach ( $variation_ids as $variation_id ) { $variation = wc_get_product( $variation_id ); @@ -325,18 +327,19 @@ class WC_Product_Variable_Data_Store_CPT extends WC_Product_Data_Store_CPT imple } } - $prices[ $variation_id ] = wc_format_decimal( $price, wc_get_price_decimals() ); - $regular_prices[ $variation_id ] = wc_format_decimal( $regular_price, wc_get_price_decimals() ); - $sale_prices[ $variation_id ] = wc_format_decimal( $sale_price . '.00', wc_get_price_decimals() ); + $prices_array['price'][ $variation_id ] = wc_format_decimal( $price, wc_get_price_decimals() ); + $prices_array['regular_price'][ $variation_id ] = wc_format_decimal( $regular_price, wc_get_price_decimals() ); + $prices_array['sale_price'][ $variation_id ] = wc_format_decimal( $sale_price . '.00', wc_get_price_decimals() ); + $prices_array = apply_filters( 'woocommerce_variation_prices_array', $prices_array, $variation, $for_display ); } - } - - $transient_cached_prices_array[ $price_hash ] = array( - 'price' => $prices, - 'regular_price' => $regular_prices, - 'sale_price' => $sale_prices, - ); + } + $transient_cached_prices_array[ $price_hash ] = apply_filters( 'woocommerce_variation_prices_transient_array', array( + 'price' => $prices_array['price'], + 'regular_price' => $prices_array['regular_price'], + 'sale_price' => $prices_array['sale_price'], + ), $prices_array, $product ); + set_transient( $transient_name, wp_json_encode( $transient_cached_prices_array ), DAY_IN_SECONDS * 30 ); } From c9f60f76697a3356030d4e1d3ddaf22484e85918 Mon Sep 17 00:00:00 2001 From: Chunkford Date: Wed, 8 Aug 2018 12:31:38 +0100 Subject: [PATCH 003/366] Update class-wc-product-variable-data-store-cpt.php --- .../class-wc-product-variable-data-store-cpt.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/includes/data-stores/class-wc-product-variable-data-store-cpt.php b/includes/data-stores/class-wc-product-variable-data-store-cpt.php index 75e38571026..beeb7aa53b6 100644 --- a/includes/data-stores/class-wc-product-variable-data-store-cpt.php +++ b/includes/data-stores/class-wc-product-variable-data-store-cpt.php @@ -334,11 +334,10 @@ class WC_Product_Variable_Data_Store_CPT extends WC_Product_Data_Store_CPT imple } } - $transient_cached_prices_array[ $price_hash ] = apply_filters( 'woocommerce_variation_prices_transient_array', array( - 'price' => $prices_array['price'], - 'regular_price' => $prices_array['regular_price'], - 'sale_price' => $prices_array['sale_price'], - ), $prices_array, $product ); + // Add all pricing data to the transient array + foreach( $prices_array as $key => $values ) { + $transient_cached_prices_array[$price_hash][$key] = $values; + } set_transient( $transient_name, wp_json_encode( $transient_cached_prices_array ), DAY_IN_SECONDS * 30 ); } From 1b49a2d5459934382f0b28e03798dbb50aac1918 Mon Sep 17 00:00:00 2001 From: Chunkford Date: Wed, 8 Aug 2018 12:45:03 +0100 Subject: [PATCH 004/366] Update class-wc-product-variable-data-store-cpt.php --- .../data-stores/class-wc-product-variable-data-store-cpt.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/data-stores/class-wc-product-variable-data-store-cpt.php b/includes/data-stores/class-wc-product-variable-data-store-cpt.php index beeb7aa53b6..f6465095bb5 100644 --- a/includes/data-stores/class-wc-product-variable-data-store-cpt.php +++ b/includes/data-stores/class-wc-product-variable-data-store-cpt.php @@ -334,9 +334,9 @@ class WC_Product_Variable_Data_Store_CPT extends WC_Product_Data_Store_CPT imple } } - // Add all pricing data to the transient array + // Add all pricing data to the transient array. foreach( $prices_array as $key => $values ) { - $transient_cached_prices_array[$price_hash][$key] = $values; + $transient_cached_prices_array[ $price_hash ][ $key ] = $values; } set_transient( $transient_name, wp_json_encode( $transient_cached_prices_array ), DAY_IN_SECONDS * 30 ); From 34300a1c52aedae31dd4b5e87d46cc419449fb9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Kavalek?= Date: Thu, 16 Aug 2018 09:44:01 +0200 Subject: [PATCH 005/366] Added missing HTML filter for quantity MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit New filter into wc_add_to_cart_message which allows modify printed product quantity into message – for example in case of floats units – 1.2 kg (add_filter('woocommerce_stock_amount', 'floatval');) --- includes/wc-cart-functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/wc-cart-functions.php b/includes/wc-cart-functions.php index fb07c970c14..9dcb117b9f4 100644 --- a/includes/wc-cart-functions.php +++ b/includes/wc-cart-functions.php @@ -107,7 +107,7 @@ function wc_add_to_cart_message( $products, $show_qty = false, $return = false ) foreach ( $products as $product_id => $qty ) { /* translators: %s: product name */ - $titles[] = ( $qty > 1 ? absint( $qty ) . ' × ' : '' ) . apply_filters( 'woocommerce_add_to_cart_item_name_in_quotes', sprintf( _x( '“%s”', 'Item name in quotes', 'woocommerce' ), strip_tags( get_the_title( $product_id ) ) ), $product_id ); + $titles[] = ( $qty > 1 ? ( has_filter( 'woocommerce_add_to_cart_message_qty_html' ) ? apply_filters( 'woocommerce_add_to_cart_message_qty_html', $product_id, $qty ) : absint( $qty ) ) . ' × ' : '' ) . apply_filters( 'woocommerce_add_to_cart_item_name_in_quotes', sprintf( _x( '“%s”', 'Item name in quotes', 'woocommerce' ), strip_tags( get_the_title( $product_id ) ) ), $product_id ); $count += $qty; } From 111c2fded03c763c4b31de5f9813631a7aea7d62 Mon Sep 17 00:00:00 2001 From: James Kemp Date: Wed, 22 Aug 2018 11:37:47 +0100 Subject: [PATCH 006/366] Add more parameters to `woocommerce_variation_option_name` Add term, taxonomy, and product object to the `woocommerce_variation_option_name` filter. --- includes/wc-template-functions.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/wc-template-functions.php b/includes/wc-template-functions.php index ba3f3105a9f..648dd7ec0b4 100644 --- a/includes/wc-template-functions.php +++ b/includes/wc-template-functions.php @@ -2808,14 +2808,14 @@ if ( ! function_exists( 'wc_dropdown_variation_attribute_options' ) ) { foreach ( $terms as $term ) { if ( in_array( $term->slug, $options, true ) ) { - $html .= ''; + $html .= ''; } } } else { foreach ( $options as $option ) { // This handles < 2.4.0 bw compatibility where text attributes were not sanitized. $selected = sanitize_title( $args['selected'] ) === $args['selected'] ? selected( $args['selected'], sanitize_title( $option ), false ) : selected( $args['selected'], $option, false ); - $html .= ''; + $html .= ''; } } } @@ -3278,7 +3278,7 @@ function wc_get_formatted_cart_item_data( $cart_item, $flat = false ) { $label = wc_attribute_label( $taxonomy ); } else { // If this is a custom option slug, get the options name. - $value = apply_filters( 'woocommerce_variation_option_name', $value ); + $value = apply_filters( 'woocommerce_variation_option_name', $value, null, $taxonomy, $cart_item['data'] ); $label = wc_attribute_label( str_replace( 'attribute_', '', $name ), $cart_item['data'] ); } From 9fe201dd86076a33fa633192645160780a0c224e Mon Sep 17 00:00:00 2001 From: James Kemp Date: Wed, 22 Aug 2018 11:44:40 +0100 Subject: [PATCH 007/366] Add parameters to `woocommerce_variation_option_name` in admin view --- includes/admin/meta-boxes/views/html-variation-admin.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/admin/meta-boxes/views/html-variation-admin.php b/includes/admin/meta-boxes/views/html-variation-admin.php index 96e20d2ea1c..df70677cf67 100644 --- a/includes/admin/meta-boxes/views/html-variation-admin.php +++ b/includes/admin/meta-boxes/views/html-variation-admin.php @@ -35,11 +35,11 @@ if ( ! defined( 'ABSPATH' ) ) { is_taxonomy() ) : ?> get_terms() as $option ) : ?> - + get_options() as $option ) : ?> - + From 1ca1189f79cb337b40607a2a210b035a7f291aaa Mon Sep 17 00:00:00 2001 From: James Kemp Date: Wed, 22 Aug 2018 11:49:17 +0100 Subject: [PATCH 008/366] Add params to `woocommerce_variation_option_name` for admin variations --- .../admin/meta-boxes/views/html-product-data-variations.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/admin/meta-boxes/views/html-product-data-variations.php b/includes/admin/meta-boxes/views/html-product-data-variations.php index 36c6a32d8b6..c6ebfac5006 100644 --- a/includes/admin/meta-boxes/views/html-product-data-variations.php +++ b/includes/admin/meta-boxes/views/html-product-data-variations.php @@ -33,11 +33,11 @@ if ( ! defined( 'ABSPATH' ) ) { is_taxonomy() ) : ?> get_terms() as $option ) : ?> - + get_options() as $option ) : ?> - + From dafcbc56b096065e0687bedd05e22cf67307d686 Mon Sep 17 00:00:00 2001 From: Grzegorz Rola Date: Wed, 29 Aug 2018 13:22:51 +0200 Subject: [PATCH 009/366] Taxes should be rounded on subtotals in cart when option woocommerce_tax_round_at_subtotal is checked. --- includes/class-wc-cart-totals.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/includes/class-wc-cart-totals.php b/includes/class-wc-cart-totals.php index 538977363f0..b7ce7cf3686 100644 --- a/includes/class-wc-cart-totals.php +++ b/includes/class-wc-cart-totals.php @@ -580,9 +580,28 @@ final class WC_Cart_Totals { } } + $taxes = $this->round_merged_taxes( $taxes ); + return $in_cents ? $taxes : wc_remove_number_precision_deep( $taxes ); } + /** + * Round merged taxes. + * + * @since 3.4.5 + * @param array $taxes Taxes to round. + * @return array + */ + protected function round_merged_taxes( $taxes ) { + if ( $this->round_at_subtotal() ) { + foreach ( $taxes as $rate_id => $tax ) { + $taxes[ $rate_id ] = wc_round_tax_total( $tax, 0 ); + } + } + + return $taxes; + } + /** * Combine item taxes into a single array, preserving keys. * From 5c3f4c9c10226e2a3cf888109339e9dfb79d7c7a Mon Sep 17 00:00:00 2001 From: Grzegorz Rola Date: Wed, 29 Aug 2018 13:25:22 +0200 Subject: [PATCH 010/366] Revert "Taxes should be rounded on subtotals in cart when option woocommerce_tax_round_at_subtotal is checked." This reverts commit dafcbc5 --- includes/class-wc-cart-totals.php | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/includes/class-wc-cart-totals.php b/includes/class-wc-cart-totals.php index b7ce7cf3686..538977363f0 100644 --- a/includes/class-wc-cart-totals.php +++ b/includes/class-wc-cart-totals.php @@ -580,28 +580,9 @@ final class WC_Cart_Totals { } } - $taxes = $this->round_merged_taxes( $taxes ); - return $in_cents ? $taxes : wc_remove_number_precision_deep( $taxes ); } - /** - * Round merged taxes. - * - * @since 3.4.5 - * @param array $taxes Taxes to round. - * @return array - */ - protected function round_merged_taxes( $taxes ) { - if ( $this->round_at_subtotal() ) { - foreach ( $taxes as $rate_id => $tax ) { - $taxes[ $rate_id ] = wc_round_tax_total( $tax, 0 ); - } - } - - return $taxes; - } - /** * Combine item taxes into a single array, preserving keys. * From 20ac4a8b69d5acd9af81b35982b52878fd738cd0 Mon Sep 17 00:00:00 2001 From: Grzegorz Rola Date: Wed, 29 Aug 2018 13:34:22 +0200 Subject: [PATCH 011/366] Taxes should be rounded on subtotals in cart when option woocommerce_tax_round_at_subtotal is checked. --- includes/class-wc-cart-totals.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/includes/class-wc-cart-totals.php b/includes/class-wc-cart-totals.php index 538977363f0..34f64c1f396 100644 --- a/includes/class-wc-cart-totals.php +++ b/includes/class-wc-cart-totals.php @@ -579,10 +579,28 @@ final class WC_Cart_Totals { $taxes[ $rate_id ] += $this->round_line_tax( $rate ); } } + $taxes = $this->round_merged_taxes( $taxes ); return $in_cents ? $taxes : wc_remove_number_precision_deep( $taxes ); } + /** + * Round merged taxes. + * + * @since 3.4.5 + * @param array $taxes Taxes to round. + * @return array + */ + protected function round_merged_taxes( $taxes ) { + if ( $this->round_at_subtotal() ) { + foreach ( $taxes as $rate_id => $tax ) { + $taxes[ $rate_id ] = wc_round_tax_total( $tax, 0 ); + } + } + + return $taxes; + } + /** * Combine item taxes into a single array, preserving keys. * From 9df10fac5ae358f27771851e5fdea991def7ce6d Mon Sep 17 00:00:00 2001 From: Grzegorz Rola Date: Wed, 29 Aug 2018 13:43:13 +0200 Subject: [PATCH 012/366] Taxes should be rounded on subtotals in cart when option woocommerce_tax_round_at_subtotal is checked. --- includes/class-wc-cart-totals.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class-wc-cart-totals.php b/includes/class-wc-cart-totals.php index 34f64c1f396..35ae4b1552c 100644 --- a/includes/class-wc-cart-totals.php +++ b/includes/class-wc-cart-totals.php @@ -591,7 +591,7 @@ final class WC_Cart_Totals { * @param array $taxes Taxes to round. * @return array */ - protected function round_merged_taxes( $taxes ) { + protected function round_merged_taxes( array $taxes ) { if ( $this->round_at_subtotal() ) { foreach ( $taxes as $rate_id => $tax ) { $taxes[ $rate_id ] = wc_round_tax_total( $tax, 0 ); From 9e32117d732f755c394ca49c549152a3181c9e9b Mon Sep 17 00:00:00 2001 From: Grzegorz Rola Date: Wed, 29 Aug 2018 18:18:57 +0200 Subject: [PATCH 013/366] Tests. --- tests/unit-tests/cart/cart.php | 84 ++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/tests/unit-tests/cart/cart.php b/tests/unit-tests/cart/cart.php index f5b6e9db918..caae1738898 100644 --- a/tests/unit-tests/cart/cart.php +++ b/tests/unit-tests/cart/cart.php @@ -11,6 +11,90 @@ class WC_Tests_Cart extends WC_Unit_Test_Case { WC()->cart->empty_cart(); } + /** + * Test tax rounding. + * Ticket: + * https://github.com/woocommerce/woocommerce/issues/21021 + */ + public function test_cart_get_total_issue_21021() { + update_option( 'woocommerce_prices_include_tax', 'yes' ); + update_option( 'woocommerce_calc_taxes', 'yes' ); + update_option( 'woocommerce_tax_round_at_subtotal', 'yes' ); + + $tax_rate = array( + 'tax_rate_country' => '', + 'tax_rate_state' => '', + 'tax_rate' => '23.0000', + 'tax_rate_name' => 'TAX23', + 'tax_rate_priority' => '1', + 'tax_rate_compound' => '0', + 'tax_rate_shipping' => '1', + 'tax_rate_order' => '1', + 'tax_rate_class' => '23percent', + ); + WC_Tax::_insert_tax_rate( $tax_rate ); + + $tax_rate = array( + 'tax_rate_country' => '', + 'tax_rate_state' => '', + 'tax_rate' => '5.0000', + 'tax_rate_name' => 'TAX5', + 'tax_rate_priority' => '2', + 'tax_rate_compound' => '0', + 'tax_rate_shipping' => '0', + 'tax_rate_order' => '1', + 'tax_rate_class' => '5percent', + ); + WC_Tax::_insert_tax_rate( $tax_rate ); + + // Create product with price 19 + $product = WC_Helper_Product::create_simple_product(); + $product->set_price( 19 ); + $product->set_regular_price(19 ); + $product->set_tax_class('5percent'); + $product->save(); + + // Create product with price 59 + $product2 = WC_Helper_Product::create_simple_product(); + $product2->set_price( 59 ); + $product2->set_regular_price(59 ); + $product->set_tax_class('5percent'); + $product2->save(); + + + // Create a flat rate method. + $flat_rate_settings = array( + 'enabled' => 'yes', + 'title' => 'Flat rate', + 'availability' => 'all', + 'countries' => '', + 'tax_status' => 'taxable', + 'cost' => '8.05', + ); + update_option( 'woocommerce_flat_rate_settings', $flat_rate_settings ); + update_option( 'woocommerce_flat_rate', array() ); + WC_Cache_Helper::get_transient_version( 'shipping', true ); + WC()->shipping->load_shipping_methods(); + + WC()->cart->empty_cart(); + + // Set the flat_rate shipping method + WC()->session->set( 'chosen_shipping_methods', array( 'flat_rate' ) ); + + // Add product to cart x1, calc and test + WC()->cart->add_to_cart( $product->get_id(), 1 ); + WC()->session->set( 'chosen_shipping_methods', array( 'flat_rate' ) ); + WC()->cart->calculate_totals(); + $this->assertEquals( 28.9, WC()->cart->total ); + + // Add product2 to cart + WC()->cart->add_to_cart( $product2->get_id(), 1 ); + WC()->session->set( 'chosen_shipping_methods', array( 'flat_rate' ) ); + WC()->cart->calculate_totals(); + $this->assertEquals( 87.9, WC()->cart->total ); + + } + /** * Test some discount logic which has caused issues in the past. * Ticket: From 2a7d84c208c1ae154df92c890941189bd0742866 Mon Sep 17 00:00:00 2001 From: Grzegorz Rola Date: Wed, 29 Aug 2018 19:24:29 +0200 Subject: [PATCH 014/366] Clean data after test. --- tests/unit-tests/cart/cart.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/unit-tests/cart/cart.php b/tests/unit-tests/cart/cart.php index caae1738898..0822fe5f36c 100644 --- a/tests/unit-tests/cart/cart.php +++ b/tests/unit-tests/cart/cart.php @@ -32,7 +32,7 @@ class WC_Tests_Cart extends WC_Unit_Test_Case { 'tax_rate_order' => '1', 'tax_rate_class' => '23percent', ); - WC_Tax::_insert_tax_rate( $tax_rate ); + $tax_rate_23 = WC_Tax::_insert_tax_rate( $tax_rate ); $tax_rate = array( 'tax_rate_country' => '', @@ -45,7 +45,7 @@ class WC_Tests_Cart extends WC_Unit_Test_Case { 'tax_rate_order' => '1', 'tax_rate_class' => '5percent', ); - WC_Tax::_insert_tax_rate( $tax_rate ); + $tax_rate_5 = WC_Tax::_insert_tax_rate( $tax_rate ); // Create product with price 19 $product = WC_Helper_Product::create_simple_product(); @@ -61,7 +61,6 @@ class WC_Tests_Cart extends WC_Unit_Test_Case { $product->set_tax_class('5percent'); $product2->save(); - // Create a flat rate method. $flat_rate_settings = array( 'enabled' => 'yes', @@ -93,6 +92,12 @@ class WC_Tests_Cart extends WC_Unit_Test_Case { WC()->cart->calculate_totals(); $this->assertEquals( 87.9, WC()->cart->total ); + WC_Helper_Product::delete_product( $product->get_id() ); + WC_Helper_Product::delete_product( $product2->get_id() ); + + WC_Tax::_delete_tax_rate( $tax_rate_23 ); + WC_Tax::_delete_tax_rate( $tax_rate_5 ); + } /** From a1cc4395695a4ca45f647444c5cc3f6e5f6ef07a Mon Sep 17 00:00:00 2001 From: Grzegorz Rola Date: Wed, 29 Aug 2018 19:43:57 +0200 Subject: [PATCH 015/366] Code style changes. --- tests/unit-tests/cart/cart.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/unit-tests/cart/cart.php b/tests/unit-tests/cart/cart.php index 0822fe5f36c..3555906dc30 100644 --- a/tests/unit-tests/cart/cart.php +++ b/tests/unit-tests/cart/cart.php @@ -50,15 +50,15 @@ class WC_Tests_Cart extends WC_Unit_Test_Case { // Create product with price 19 $product = WC_Helper_Product::create_simple_product(); $product->set_price( 19 ); - $product->set_regular_price(19 ); - $product->set_tax_class('5percent'); + $product->set_regular_price( 19 ); + $product->set_tax_class( '5percent' ); $product->save(); // Create product with price 59 $product2 = WC_Helper_Product::create_simple_product(); $product2->set_price( 59 ); - $product2->set_regular_price(59 ); - $product->set_tax_class('5percent'); + $product2->set_regular_price( 59 ); + $product->set_tax_class( '5percent' ); $product2->save(); // Create a flat rate method. From 5ee8a794f0648105dd1893959a966c1fb54f6f90 Mon Sep 17 00:00:00 2001 From: Raymond Johnson Date: Thu, 30 Aug 2018 17:53:32 -0500 Subject: [PATCH 016/366] Add consistent classes to order tracking form. --- templates/order/form-tracking.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/order/form-tracking.php b/templates/order/form-tracking.php index 20d34e32512..631f2cd776f 100644 --- a/templates/order/form-tracking.php +++ b/templates/order/form-tracking.php @@ -20,7 +20,7 @@ defined( 'ABSPATH' ) || exit; global $post; ?> -
+

From f93f36ee65b972330c4357f79c8da5fd871f359a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Kavalek?= Date: Wed, 5 Sep 2018 20:39:12 +0200 Subject: [PATCH 017/366] Added missing HTML filter for quantity https://github.com/woocommerce/woocommerce/pull/21069#pullrequestreview-147005349 --- includes/wc-cart-functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/wc-cart-functions.php b/includes/wc-cart-functions.php index 9dcb117b9f4..dc7d3f2a397 100644 --- a/includes/wc-cart-functions.php +++ b/includes/wc-cart-functions.php @@ -107,7 +107,7 @@ function wc_add_to_cart_message( $products, $show_qty = false, $return = false ) foreach ( $products as $product_id => $qty ) { /* translators: %s: product name */ - $titles[] = ( $qty > 1 ? ( has_filter( 'woocommerce_add_to_cart_message_qty_html' ) ? apply_filters( 'woocommerce_add_to_cart_message_qty_html', $product_id, $qty ) : absint( $qty ) ) . ' × ' : '' ) . apply_filters( 'woocommerce_add_to_cart_item_name_in_quotes', sprintf( _x( '“%s”', 'Item name in quotes', 'woocommerce' ), strip_tags( get_the_title( $product_id ) ) ), $product_id ); + $titles[] = apply_filters( 'woocommerce_add_to_cart_qty_html', ( $qty > 1 ? absint( $qty ) . ' × ' : '' ), $product_id ) . apply_filters( 'woocommerce_add_to_cart_item_name_in_quotes', sprintf( _x( '“%s”', 'Item name in quotes', 'woocommerce' ), strip_tags( get_the_title( $product_id ) ) ), $product_id ); $count += $qty; } From 36cf6d64b8784af7952e810b76efc18f22334d2a Mon Sep 17 00:00:00 2001 From: Gerhard Potgieter Date: Mon, 10 Sep 2018 11:23:12 +0200 Subject: [PATCH 018/366] Check the post status and set the hidden field based on that before submitting. --- assets/js/admin/meta-boxes-product-variation.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/assets/js/admin/meta-boxes-product-variation.js b/assets/js/admin/meta-boxes-product-variation.js index e1e7fcf8e12..44f9d486292 100644 --- a/assets/js/admin/meta-boxes-product-variation.js +++ b/assets/js/admin/meta-boxes-product-variation.js @@ -524,7 +524,11 @@ jQuery( function( $ ) { * After saved, continue with form submission */ save_on_submit_done: function() { - $( 'form#post' ).append('').submit(); + if ( $( '#hidden_post_status' ).val() !== 'publish' ) { + $( 'form#post' ).append('').submit(); + } else { + $( 'form#post' ).append('').submit(); + } }, /** From 37da7b6680e14449688bd818c490de9c04524fed Mon Sep 17 00:00:00 2001 From: Reuven Karasik Date: Thu, 13 Sep 2018 12:17:51 +0300 Subject: [PATCH 019/366] Added action 'woocommerce_variation_header' action --- .../admin/meta-boxes/views/html-variation-admin.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/includes/admin/meta-boxes/views/html-variation-admin.php b/includes/admin/meta-boxes/views/html-variation-admin.php index 06e3823884f..f8e73884d7e 100644 --- a/includes/admin/meta-boxes/views/html-variation-admin.php +++ b/includes/admin/meta-boxes/views/html-variation-admin.php @@ -48,6 +48,17 @@ if ( ! defined( 'ABSPATH' ) ) { ?> + +