diff --git a/assets/js/frontend/checkout.js b/assets/js/frontend/checkout.js index 0b039693259..c3aa75f323d 100644 --- a/assets/js/frontend/checkout.js +++ b/assets/js/frontend/checkout.js @@ -39,7 +39,7 @@ jQuery( function( $ ) { this.$checkout_form.on( 'update', this.trigger_update_checkout ); // Inputs/selects which update totals - this.$checkout_form.on( 'change', 'select.shipping_method, input[name^="shipping_method"], #ship-to-different-address input, .update_totals_on_change select, .update_totals_on_change input[type="radio"], .update_totals_on_change input[type="checkbox"]', this.trigger_update_checkout ); + this.$checkout_form.on( 'change', 'select.shipping_method, input[name^="shipping_method"], #ship-to-different-address-checkbox input, .update_totals_on_change select, .update_totals_on_change input[type="radio"], .update_totals_on_change input[type="checkbox"]', this.trigger_update_checkout ); this.$checkout_form.on( 'change', '.address-field select', this.input_changed ); this.$checkout_form.on( 'change', '.address-field input.input-text, .update_totals_on_change input.input-text', this.maybe_input_changed ); this.$checkout_form.on( 'keydown', '.address-field input.input-text, .update_totals_on_change input.input-text', this.queue_update_checkout ); diff --git a/includes/shortcodes/class-wc-shortcode-products.php b/includes/shortcodes/class-wc-shortcode-products.php index b887894feda..72de10afaaa 100644 --- a/includes/shortcodes/class-wc-shortcode-products.php +++ b/includes/shortcodes/class-wc-shortcode-products.php @@ -177,9 +177,14 @@ class WC_Shortcode_Products { 'ignore_sticky_posts' => true, 'no_found_rows' => false === wc_string_to_bool( $this->attributes['paginate'] ), 'orderby' => empty( $_GET['orderby'] ) ? $this->attributes['orderby'] : wc_clean( wp_unslash( $_GET['orderby'] ) ), - 'order' => strtoupper( $this->attributes['order'] ), ); + $orderby_value = explode( '-', $query_args['orderby'] ); + $orderby = esc_attr( $orderby_value[0] ); + $order = ! empty( $orderby_value[1] ) ? $orderby_value[1] : strtoupper( $this->attributes['order'] ); + $query_args['orderby'] = $orderby; + $query_args['order'] = $order; + if ( wc_string_to_bool( $this->attributes['paginate'] ) ) { $this->attributes['page'] = absint( empty( $_GET['product-page'] ) ? 1 : $_GET['product-page'] ); // WPCS: input var ok, CSRF ok. }