diff --git a/assets/js/admin/quick-edit.js b/assets/js/admin/quick-edit.js index 9509fc533b9..ca1dbfaf630 100644 --- a/assets/js/admin/quick-edit.js +++ b/assets/js/admin/quick-edit.js @@ -42,11 +42,10 @@ jQuery(function( $ ) { $( 'input[name="_stock"]', '.inline-edit-row' ).val( stock ); $( 'input[name="menu_order"]', '.inline-edit-row' ).val( menu_order ); + $( 'select[name="_tax_status"] option, select[name="_tax_class"] option, select[name="_visibility"] option, select[name="_stock_status"] option, select[name="_backorders"] option' ).removeAttr( 'selected' ); + $( 'select[name="_tax_status"] option[value="' + tax_status + '"]', '.inline-edit-row' ).attr( 'selected', 'selected' ); $( 'select[name="_tax_class"] option[value="' + tax_class + '"]', '.inline-edit-row' ).attr( 'selected', 'selected' ); - - $( 'select[name="_visibility"] option, select[name="_stock_status"] option, select[name="_backorders"] option' ).removeAttr( 'selected' ); - $( 'select[name="_visibility"] option[value="' + visibility + '"]', '.inline-edit-row' ).attr( 'selected', 'selected' ); $( 'select[name="_stock_status"] option[value="' + stock_status + '"]', '.inline-edit-row' ).attr( 'selected', 'selected' ); $( 'select[name="_backorders"] option[value="' + backorders + '"]', '.inline-edit-row' ).attr( 'selected', 'selected' ); diff --git a/assets/js/admin/quick-edit.min.js b/assets/js/admin/quick-edit.min.js index f17c216319f..549395d247c 100644 --- a/assets/js/admin/quick-edit.min.js +++ b/assets/js/admin/quick-edit.min.js @@ -1 +1 @@ -jQuery(function(a){a("#the-list").on("click",".editinline",function(){inlineEditPost.revert();var b=a(this).closest("tr").attr("id");b=b.replace("post-","");var c=a("#woocommerce_inline_"+b),d=c.find(".sku").text(),e=c.find(".regular_price").text(),f=c.find(".sale_price ").text(),g=c.find(".weight").text(),h=c.find(".length").text(),i=c.find(".width").text(),j=c.find(".height").text(),k=c.find(".shipping_class").text(),l=c.find(".visibility").text(),m=c.find(".stock_status").text(),n=c.find(".stock").text(),o=c.find(".featured").text(),p=c.find(".manage_stock").text(),q=c.find(".menu_order").text(),r=c.find(".tax_status").text(),s=c.find(".tax_class").text(),t=c.find(".backorders").text();a('input[name="_sku"]',".inline-edit-row").val(d),a('input[name="_regular_price"]',".inline-edit-row").val(e),a('input[name="_sale_price"]',".inline-edit-row").val(f),a('input[name="_weight"]',".inline-edit-row").val(g),a('input[name="_length"]',".inline-edit-row").val(h),a('input[name="_width"]',".inline-edit-row").val(i),a('input[name="_height"]',".inline-edit-row").val(j),a('select[name="_shipping_class"] option:selected',".inline-edit-row").attr("selected",!1).change(),a('select[name="_shipping_class"] option[value="'+k+'"]').attr("selected","selected").change(),a('input[name="_stock"]',".inline-edit-row").val(n),a('input[name="menu_order"]',".inline-edit-row").val(q),a('select[name="_tax_status"] option[value="'+r+'"]',".inline-edit-row").attr("selected","selected"),a('select[name="_tax_class"] option[value="'+s+'"]',".inline-edit-row").attr("selected","selected"),a('select[name="_visibility"] option, select[name="_stock_status"] option, select[name="_backorders"] option').removeAttr("selected"),a('select[name="_visibility"] option[value="'+l+'"]',".inline-edit-row").attr("selected","selected"),a('select[name="_stock_status"] option[value="'+m+'"]',".inline-edit-row").attr("selected","selected"),a('select[name="_backorders"] option[value="'+t+'"]',".inline-edit-row").attr("selected","selected"),"yes"===o?a('input[name="_featured"]',".inline-edit-row").attr("checked","checked"):a('input[name="_featured"]',".inline-edit-row").removeAttr("checked"),"yes"===p?(a(".stock_qty_field",".inline-edit-row").show().removeAttr("style"),a('input[name="_manage_stock"]',".inline-edit-row").attr("checked","checked")):(a(".stock_qty_field",".inline-edit-row").hide(),a('input[name="_manage_stock"]',".inline-edit-row").removeAttr("checked"));var u=c.find(".product_type").text(),v=c.find(".product_is_virtual").text();"simple"===u||"external"===u?a(".price_fields",".inline-edit-row").show().removeAttr("style"):a(".price_fields",".inline-edit-row").hide(),"yes"===v?a(".dimension_fields",".inline-edit-row").hide():a(".dimension_fields",".inline-edit-row").show().removeAttr("style"),"grouped"===u?a(".stock_fields",".inline-edit-row").hide():a(".stock_fields",".inline-edit-row").show().removeAttr("style")}),a("#the-list").on("change",'.inline-edit-row input[name="_manage_stock"]',function(){a(this).is(":checked")?a(".stock_qty_field",".inline-edit-row").show().removeAttr("style"):a(".stock_qty_field",".inline-edit-row").hide()}),a("#wpbody").on("click","#doaction, #doaction2",function(){a("input.text",".inline-edit-row").val(""),a("#woocommerce-fields").find("select").prop("selectedIndex",0),a("#woocommerce-fields-bulk").find(".inline-edit-group .change-input").hide();var b="product_tag";a('tr.inline-editor textarea[name="tax_input['+b+']"]').suggest(ajaxurl+"?action=ajax-tag-search&tax="+b,{delay:500,minchars:2,multiple:!0,multipleSep:inlineEditL10n.comma})}),a("#wpbody").on("change","#woocommerce-fields-bulk .inline-edit-group .change_to",function(){0 $file ) { $i++; $prefix = count( $download_files ) > 1 ? sprintf( __( 'Download %d', 'woocommerce' ), $i ) : __( 'Download', 'woocommerce' ); - $links[] = '' . $prefix . ': ' . esc_html( $file['name'] ) . '' . "\n"; + $links[] = '' . $prefix . ': ' . esc_html( $file['name'] ) . '' . "\n"; } echo '
' . implode( '
', $links ); @@ -2498,7 +2498,7 @@ abstract class WC_Abstract_Order { if ( ! $notification_sent && 'yes' == get_option( 'woocommerce_notify_low_stock' ) && get_option( 'woocommerce_notify_low_stock_amount' ) >= $new_stock ) { do_action( 'woocommerce_low_stock', $product ); } - + do_action( 'woocommerce_after_send_stock_notifications', $product, $new_stock, $qty_ordered ); } diff --git a/includes/admin/reports/class-wc-report-sales-by-date.php b/includes/admin/reports/class-wc-report-sales-by-date.php index 01eff0ca89c..0050806dea3 100644 --- a/includes/admin/reports/class-wc-report-sales-by-date.php +++ b/includes/admin/reports/class-wc-report-sales-by-date.php @@ -350,13 +350,13 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report { 'title' => sprintf( __( '%s gross sales in this period', 'woocommerce' ), '' . wc_price( $data->total_sales ) . '' ), 'placeholder' => __( 'This is the sum of the order totals after any refunds and including shipping and taxes.', 'woocommerce' ), 'color' => $this->chart_colours['sales_amount'], - 'highlight_series' => 6 + 'highlight_series' => 5 ); $legend[] = array( 'title' => sprintf( __( '%s net sales in this period', 'woocommerce' ), '' . wc_price( $data->net_sales ) . '' ), 'placeholder' => __( 'This is the sum of the order totals after any refunds and excluding shipping and taxes.', 'woocommerce' ), 'color' => $this->chart_colours['net_sales_amount'], - 'highlight_series' => 7 + 'highlight_series' => 6 ); if ( $data->average_sales > 0 ) { $legend[] = array( @@ -379,12 +379,12 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report { $legend[] = array( 'title' => sprintf( _nx( '%s refunded %d order', '%s refunded %d orders', $this->report_data->total_refunded_orders, '%s = amount of the refunds, %d = number of refunded orders.', 'woocommerce' ), '' . wc_price( $data->total_refunds ) . '', $this->report_data->total_refunded_orders ) . ' (' . sprintf( _n( '%d item', '%d items', $this->report_data->refunded_order_items, 'woocommerce' ), $this->report_data->refunded_order_items ) . ')', 'color' => $this->chart_colours['refund_amount'], - 'highlight_series' => 4 + 'highlight_series' => 7 ); $legend[] = array( 'title' => sprintf( __( '%s charged for shipping', 'woocommerce' ), '' . wc_price( $data->total_shipping ) . '' ), 'color' => $this->chart_colours['shipping_amount'], - 'highlight_series' => 5 + 'highlight_series' => 4 ); $legend[] = array( 'title' => sprintf( __( '%s worth of coupons used', 'woocommerce' ), '' . wc_price( $data->total_coupons ) . '' ), diff --git a/includes/admin/views/html-admin-page-status-report.php b/includes/admin/views/html-admin-page-status-report.php index 10f4907d974..6733ac850e5 100644 --- a/includes/admin/views/html-admin-page-status-report.php +++ b/includes/admin/views/html-admin-page-status-report.php @@ -322,7 +322,8 @@ if ( ! defined( 'ABSPATH' ) ) { $active_plugins = (array) get_option( 'active_plugins', array() ); if ( is_multisite() ) { - $active_plugins = array_merge( $active_plugins, get_site_option( 'active_sitewide_plugins', array() ) ); + $network_activated_plugins = array_keys( get_site_option( 'active_sitewide_plugins', array() ) ); + $active_plugins = array_merge( $active_plugins, $network_activated_plugins ); } foreach ( $active_plugins as $plugin ) { diff --git a/includes/admin/views/html-bulk-edit-product.php b/includes/admin/views/html-bulk-edit-product.php index a2d13024978..2911cfd6e71 100644 --- a/includes/admin/views/html-bulk-edit-product.php +++ b/includes/admin/views/html-bulk-edit-product.php @@ -65,49 +65,51 @@ if ( ! defined( 'ABSPATH' ) ) { - - - - foreach ( $options as $key => $value ) { - echo ''; - } - ?> - - - + +
diff --git a/includes/admin/views/html-quick-edit-product.php b/includes/admin/views/html-quick-edit-product.php index bcf574a428c..04794a3b0e0 100644 --- a/includes/admin/views/html-quick-edit-product.php +++ b/includes/admin/views/html-quick-edit-product.php @@ -45,48 +45,50 @@ if ( ! defined( 'ABSPATH' ) ) {
- -
- +
+ -
+ $tax_classes = WC_Tax::get_tax_classes(); + + if ( $tax_classes ) + foreach ( $tax_classes as $class ) { + $options[ sanitize_title( $class ) ] = esc_html( $class ); + } + + foreach ( $options as $key => $value ) { + echo ''; + } + ?> + + + +
+
diff --git a/includes/api/class-wc-api-customers.php b/includes/api/class-wc-api-customers.php index ec633492711..2093282d7b8 100644 --- a/includes/api/class-wc-api-customers.php +++ b/includes/api/class-wc-api-customers.php @@ -461,37 +461,20 @@ class WC_API_Customers extends WC_API_Resource { * @since 2.1 * @param int $id the customer ID * @param string $fields fields to include in response + * @param array $filter filters * @return array */ - public function get_customer_orders( $id, $fields = null ) { - global $wpdb; - + public function get_customer_orders( $id, $fields = null, $filter = array() ) { $id = $this->validate_request( $id, 'customer', 'read' ); if ( is_wp_error( $id ) ) { return $id; } - $order_ids = $wpdb->get_col( $wpdb->prepare( "SELECT id - FROM $wpdb->posts AS posts - LEFT JOIN {$wpdb->postmeta} AS meta on posts.ID = meta.post_id - WHERE meta.meta_key = '_customer_user' - AND meta.meta_value = '%s' - AND posts.post_type = 'shop_order' - AND posts.post_status IN ( '" . implode( "','", array_keys( wc_get_order_statuses() ) ) . "' ) - ", $id ) ); + $filter['customer_id'] = $id; + $orders = WC()->api->WC_API_Orders->get_orders( $fields, $filter, null, -1 ); - if ( empty( $order_ids ) ) { - return array( 'orders' => array() ); - } - - $orders = array(); - - foreach ( $order_ids as $order_id ) { - $orders[] = current( WC()->api->WC_API_Orders->get_order( $order_id, $fields ) ); - } - - return array( 'orders' => apply_filters( 'woocommerce_api_customer_orders_response', $orders, $id, $fields, $order_ids, $this->server ) ); + return $orders; } /** diff --git a/includes/api/class-wc-api-orders.php b/includes/api/class-wc-api-orders.php index 1bca40bb787..716a94388fc 100644 --- a/includes/api/class-wc-api-orders.php +++ b/includes/api/class-wc-api-orders.php @@ -711,13 +711,21 @@ class WC_API_Orders extends WC_API_Resource { // add status argument if ( ! empty( $args['status'] ) ) { - $statuses = 'wc-' . str_replace( ',', ',wc-', $args['status'] ); $statuses = explode( ',', $statuses ); $query_args['post_status'] = $statuses; unset( $args['status'] ); + } + if ( ! empty( $args['customer_id'] ) ) { + $query_args['meta_query'] = array( + array( + 'key' => '_customer_user', + 'value' => absint( $args['customer_id'] ), + 'compare' => '=' + ) + ); } $query_args = $this->merge_query_args( $query_args, $args ); diff --git a/includes/class-wc-product-variation.php b/includes/class-wc-product-variation.php index 1a03eb7797c..9c5a93568c3 100644 --- a/includes/class-wc-product-variation.php +++ b/includes/class-wc-product-variation.php @@ -664,6 +664,6 @@ class WC_Product_Variation extends WC_Product { * @return string */ public function get_variation_description() { - return wpautop( wp_kses_post( get_post_meta( $this->variation_id, '_variation_description', true ) ) ); + return wpautop( do_shortcode( wp_kses_post( get_post_meta( $this->variation_id, '_variation_description', true ) ) ) ); } } diff --git a/includes/gateways/paypal/includes/class-wc-gateway-paypal-request.php b/includes/gateways/paypal/includes/class-wc-gateway-paypal-request.php index 83a683dc69a..d64d24a586d 100644 --- a/includes/gateways/paypal/includes/class-wc-gateway-paypal-request.php +++ b/includes/gateways/paypal/includes/class-wc-gateway-paypal-request.php @@ -103,6 +103,7 @@ class WC_Gateway_Paypal_Request { protected function get_phone_number_args( $order ) { if ( in_array( $order->billing_country, array( 'US','CA' ) ) ) { $phone_number = str_replace( array( '(', '-', ' ', ')', '.' ), '', $order->billing_phone ); + $phone_number = ltrim( $phone_number, '+1' ); $phone_args = array( 'night_phone_a' => substr( $phone_number, 0, 3 ), 'night_phone_b' => substr( $phone_number, 3, 3 ), diff --git a/includes/wc-template-functions.php b/includes/wc-template-functions.php index 41f7a2f2b84..e903e37ffdc 100644 --- a/includes/wc-template-functions.php +++ b/includes/wc-template-functions.php @@ -1133,15 +1133,17 @@ if ( ! function_exists( 'woocommerce_upsell_display' ) ) { * Output product up sells. * * @param int $posts_per_page (default: -1) - * @param int $columns (default: 2) + * @param int $columns (default: 4) * @param string $orderby (default: 'rand') */ function woocommerce_upsell_display( $posts_per_page = '-1', $columns = 4, $orderby = 'rand' ) { - wc_get_template( 'single-product/up-sells.php', array( - 'posts_per_page' => $posts_per_page, - 'orderby' => apply_filters( 'woocommerce_upsells_orderby', $orderby ), - 'columns' => $columns - ) ); + $args = apply_filters( 'woocommerce_upsell_display_args', array( + 'posts_per_page' => $posts_per_page, + 'orderby' => apply_filters( 'woocommerce_upsells_orderby', $orderby ), + 'columns' => $columns + ) ); + + wc_get_template( 'single-product/up-sells.php', $args ); } }