Version Description
- 2019-05-27 =
- Enhancement - Add notice to install WooCommerce Admin. #23659
- Fix - Tracks: Add check for OBW is-opting-in. #23772
- Fix - Use HTTP protocol for schema.org's availability. #23774
- Fix - Coupon usage limit checks based on email never ran when orders are created via wp-admin. #23775
- Fix - Duplicate out of stock notices when navigating from cart to checkout and back to cart. #23791
- Fix - Remove sensitive information from refund reason when manually refunding an order, and move it to an order note. #23739
- Tweak - Tracks: set cookie on admin_init instead of wp_loaded. #23787
- Dev - Fixed number of arguments for all occurrences of the woocommerce_valid_order_statuses_for_cancel filter. #23704
- Dev - REST API - Stop order creation if invalid data is sent. #23325
- Dev - Introduce new wc_load_cart function for dynamically loading and initializing the cart. #23794
Download this release
Release Info
Developer | rodrigosprimo |
Plugin | WooCommerce |
Version | 3.6.4 |
Comparing to | |
See all releases |
Code changes from version 3.6.3 to 3.6.4
- assets/js/admin/meta-boxes-order.js +9 -7
- assets/js/admin/meta-boxes-order.min.js +1 -1
- i18n/languages/woocommerce.pot +54 -35
- includes/abstracts/abstract-wc-order.php +15 -0
- includes/admin/class-wc-admin-notices.php +32 -0
- includes/admin/views/html-notice-wc-admin.php +35 -0
- includes/api/class-wc-rest-orders-controller.php +19 -0
- includes/class-wc-ajax.php +6 -2
- includes/class-wc-form-handler.php +1 -1
- includes/class-wc-structured-data.php +1 -1
- includes/class-woocommerce.php +35 -12
- includes/data-stores/class-wc-coupon-data-store-cpt.php +13 -0
- includes/shortcodes/class-wc-shortcode-checkout.php +1 -0
- includes/tracks/class-wc-site-tracking.php +8 -4
- includes/tracks/class-wc-tracks-client.php +1 -1
- includes/tracks/class-wc-tracks.php +2 -6
- includes/wc-core-functions.php +11 -0
- includes/wc-order-functions.php +3 -1
- readme.txt +13 -1
- woocommerce.php +1 -1
assets/js/admin/meta-boxes-order.js
CHANGED
@@ -400,15 +400,17 @@ jQuery( function ( $ ) {
|
|
400 |
if ( value != null ) {
|
401 |
wc_meta_boxes_order_items.block();
|
402 |
|
403 |
-
var user_id
|
|
|
404 |
|
405 |
var data = $.extend( {}, wc_meta_boxes_order_items.get_taxable_address(), {
|
406 |
-
action
|
407 |
-
dataType
|
408 |
-
order_id
|
409 |
-
security
|
410 |
-
coupon
|
411 |
-
user_id
|
|
|
412 |
} );
|
413 |
|
414 |
$.post( woocommerce_admin_meta_boxes.ajax_url, data, function( response ) {
|
400 |
if ( value != null ) {
|
401 |
wc_meta_boxes_order_items.block();
|
402 |
|
403 |
+
var user_id = $( '#customer_user' ).val();
|
404 |
+
var user_email = $( '#_billing_email' ).val();
|
405 |
|
406 |
var data = $.extend( {}, wc_meta_boxes_order_items.get_taxable_address(), {
|
407 |
+
action : 'woocommerce_add_coupon_discount',
|
408 |
+
dataType : 'json',
|
409 |
+
order_id : woocommerce_admin_meta_boxes.post_id,
|
410 |
+
security : woocommerce_admin_meta_boxes.order_item_nonce,
|
411 |
+
coupon : value,
|
412 |
+
user_id : user_id,
|
413 |
+
user_email : user_email
|
414 |
} );
|
415 |
|
416 |
$.post( woocommerce_admin_meta_boxes.ajax_url, data, function( response ) {
|
assets/js/admin/meta-boxes-order.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(function(u){var p={states:null,init:function(){"undefined"!=typeof woocommerce_admin_meta_boxes_order&&"undefined"!=typeof woocommerce_admin_meta_boxes_order.countries&&(this.states=u.parseJSON(woocommerce_admin_meta_boxes_order.countries.replace(/"/g,'"'))),u(".js_field-country").selectWoo().change(this.change_country),u(".js_field-country").trigger("change",[!0]),u(document.body).on("change","select.js_field-state",this.change_state),u("#woocommerce-order-actions input, #woocommerce-order-actions a").click(function(){window.onbeforeunload=""}),u("a.edit_address").click(this.edit_address),u("a.billing-same-as-shipping").on("click",this.copy_billing_to_shipping),u("a.load_customer_billing").on("click",this.load_billing),u("a.load_customer_shipping").on("click",this.load_shipping),u("#customer_user").on("change",this.change_customer_user)},change_country:function(e,o){if(void 0===o&&(o=!1),null!==p.states){var t,a=u(this),i=a.val(),n=a.parents("div.edit_address").find(":input.js_field-state"),r=n.parent(),c=n.attr("name"),d=n.attr("id"),m=a.data("woocommerce.stickState-"+i)?a.data("woocommerce.stickState-"+i):n.val(),_=n.attr("placeholder");if(o&&a.data("woocommerce.stickState-"+i,m),r.show().find(".select2-container").remove(),u.isEmptyObject(p.states[i]))t=u('<input type="text" />').prop("id",d).prop("name",c).prop("placeholder",_).addClass("js_field-state").val(""),n.replaceWith(t);else{var s=p.states[i],l=u('<option value=""></option>').text(woocommerce_admin_meta_boxes_order.i18n_select_state_text);t=u("<select></select>").prop("id",d).prop("name",c).prop("placeholder",_).addClass("js_field-state select short").append(l),u.each(s,function(e){var o=u("<option></option>").prop("value",e).text(s[e]);t.append(o)}),t.val(m),n.replaceWith(t),t.show().selectWoo().hide().change()}u(document.body).trigger("contry-change.woocommerce",[i,u(this).closest("div")]),u(document.body).trigger("country-change.woocommerce",[i,u(this).closest("div")])}},change_state:function(){var e=u(this),o=e.val(),t=e.parents("div.edit_address").find(":input.js_field-country"),a=t.val();t.data("woocommerce.stickState-"+a,o)},init_tiptip:function(){u("#tiptip_holder").removeAttr("style"),u("#tiptip_arrow").removeAttr("style"),u(".tips").tipTip({attribute:"data-tip",fadeIn:50,fadeOut:50,delay:200})},edit_address:function(e){e.preventDefault();var o=u(this),t=o.closest(".order_data_column"),a=t.find("div.edit_address"),i=t.find("div.address"),n=a.find(".js_field-country"),r=a.find(".js_field-state");i.hide(),o.parent().find("a").toggle(),n.val()||(n.val(woocommerce_admin_meta_boxes_order.default_country).change(),r.val(woocommerce_admin_meta_boxes_order.default_state).change()),a.show()},change_customer_user:function(){u("#_billing_country").val()||(u("a.edit_address").click(),p.load_billing(!0),p.load_shipping(!0))},load_billing:function(e){if(!0===e||window.confirm(woocommerce_admin_meta_boxes.load_billing)){var o=u("#customer_user").val();if(!o)return window.alert(woocommerce_admin_meta_boxes.no_customer_selected),!1;var t={user_id:o,action:"woocommerce_get_customer_details",security:woocommerce_admin_meta_boxes.get_customer_details_nonce};u(this).closest("div.edit_address").block({message:null,overlayCSS:{background:"#fff",opacity:.6}}),u.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:t,type:"POST",success:function(e){e&&e.billing&&u.each(e.billing,function(e,o){u(":input#_billing_"+e).val(o).change()}),u("div.edit_address").unblock()}})}return!1},load_shipping:function(e){if(!0===e||window.confirm(woocommerce_admin_meta_boxes.load_shipping)){var o=u("#customer_user").val();if(!o)return window.alert(woocommerce_admin_meta_boxes.no_customer_selected),!1;var t={user_id:o,action:"woocommerce_get_customer_details",security:woocommerce_admin_meta_boxes.get_customer_details_nonce};u(this).closest("div.edit_address").block({message:null,overlayCSS:{background:"#fff",opacity:.6}}),u.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:t,type:"POST",success:function(e){e&&e.billing&&u.each(e.shipping,function(e,o){u(":input#_shipping_"+e).val(o).change()}),u("div.edit_address").unblock()}})}return!1},copy_billing_to_shipping:function(){return window.confirm(woocommerce_admin_meta_boxes.copy_billing)&&u('.order_data_column :input[name^="_billing_"]').each(function(){var e=u(this).attr("name");e=e.replace("_billing_","_shipping_"),u(":input#"+e).val(u(this).val()).change()}),!1}},c={init:function(){this.stupidtable.init(),u("#woocommerce-order-items").on("click","button.add-line-item",this.add_line_item).on("click","button.add-coupon",this.add_coupon).on("click","a.remove-coupon",this.remove_coupon).on("click","button.refund-items",this.refund_items).on("click",".cancel-action",this.cancel).on("click","button.add-order-item",this.add_item).on("click","button.add-order-fee",this.add_fee).on("click","button.add-order-shipping",this.add_shipping).on("click","button.add-order-tax",this.add_tax).on("click","button.save-action",this.save_line_items).on("click","a.delete-order-tax",this.delete_tax).on("click","button.calculate-action",this.recalculate).on("click","a.edit-order-item",this.edit_item).on("click","a.delete-order-item",this.delete_item).on("click",".delete_refund",this.refunds.delete_refund).on("click","button.do-api-refund, button.do-manual-refund",this.refunds.do_refund).on("change",".refund input.refund_line_total, .refund input.refund_line_tax",this.refunds.input_changed).on("change keyup",".wc-order-refund-items #refund_amount",this.refunds.amount_changed).on("change","input.refund_order_item_qty",this.refunds.refund_quantity_changed).on("change","input.quantity",this.quantity_changed).on("keyup change",".split-input :input",function(){var e=u(this).parent().prev().find(":input");e&&(""===e.val()||e.is(".match-total"))&&e.val(u(this).val()).addClass("match-total")}).on("keyup",".split-input :input",function(){u(this).removeClass("match-total")}).on("click","button.add_order_item_meta",this.item_meta.add).on("click","button.remove_order_item_meta",this.item_meta.remove).on("wc_order_items_reload",this.reload_items).on("wc_order_items_reloaded",this.reloaded_items),u(document.body).on("wc_backbone_modal_loaded",this.backbone.init).on("wc_backbone_modal_response",this.backbone.response)},block:function(){u("#woocommerce-order-items").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},unblock:function(){u("#woocommerce-order-items").unblock()},reload_items:function(){var e={order_id:woocommerce_admin_meta_boxes.post_id,action:"woocommerce_load_order_items",security:woocommerce_admin_meta_boxes.order_item_nonce};c.block(),u.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:e,type:"POST",success:function(e){u("#woocommerce-order-items").find(".inside").empty(),u("#woocommerce-order-items").find(".inside").append(e),c.reloaded_items(),c.unblock()}})},reloaded_items:function(){p.init_tiptip(),c.stupidtable.init()},quantity_changed:function(){var n=u(this).closest("tr.item"),r=u(this).val(),c=u(this).attr("data-qty"),e=u("input.line_total",n),o=u("input.line_subtotal",n),t=accounting.unformat(e.attr("data-total"),woocommerce_admin.mon_decimal_point)/c;e.val(parseFloat(accounting.formatNumber(t*r,woocommerce_admin_meta_boxes.rounding_precision,"")).toString().replace(".",woocommerce_admin.mon_decimal_point));var a=accounting.unformat(o.attr("data-subtotal"),woocommerce_admin.mon_decimal_point)/c;o.val(parseFloat(accounting.formatNumber(a*r,woocommerce_admin_meta_boxes.rounding_precision,"")).toString().replace(".",woocommerce_admin.mon_decimal_point)),u("input.line_tax",n).each(function(){var e=u(this),o=e.data("tax_id"),t=accounting.unformat(e.attr("data-total_tax"),woocommerce_admin.mon_decimal_point)/c,a=u('input.line_subtotal_tax[data-tax_id="'+o+'"]',n),i=accounting.unformat(a.attr("data-subtotal_tax"),woocommerce_admin.mon_decimal_point)/c;0<t&&e.val(parseFloat(accounting.formatNumber(t*r,woocommerce_admin_meta_boxes.rounding_precision,"")).toString().replace(".",woocommerce_admin.mon_decimal_point)),0<i&&a.val(parseFloat(accounting.formatNumber(i*r,woocommerce_admin_meta_boxes.rounding_precision,"")).toString().replace(".",woocommerce_admin.mon_decimal_point))}),u(this).trigger("quantity_changed")},add_line_item:function(){return u("div.wc-order-add-item").slideDown(),u("div.wc-order-data-row-toggle").not("div.wc-order-add-item").slideUp(),!1},add_coupon:function(){var e=window.prompt(woocommerce_admin_meta_boxes.i18n_apply_coupon);if(null!=e){c.block();var o=u("#customer_user").val(),t=u.extend({},c.get_taxable_address(),{action:"woocommerce_add_coupon_discount",dataType:"json",order_id:woocommerce_admin_meta_boxes.post_id,security:woocommerce_admin_meta_boxes.order_item_nonce,coupon:e,user_id:o});u.post(woocommerce_admin_meta_boxes.ajax_url,t,function(e){e.success?(u("#woocommerce-order-items").find(".inside").empty(),u("#woocommerce-order-items").find(".inside").append(e.data.html),c.reloaded_items(),c.unblock()):window.alert(e.data.error),c.unblock()})}return!1},remove_coupon:function(){var e=u(this);c.block();var o=u.extend({},c.get_taxable_address(),{action:"woocommerce_remove_order_coupon",dataType:"json",order_id:woocommerce_admin_meta_boxes.post_id,security:woocommerce_admin_meta_boxes.order_item_nonce,coupon:e.data("code")});u.post(woocommerce_admin_meta_boxes.ajax_url,o,function(e){e.success?(u("#woocommerce-order-items").find(".inside").empty(),u("#woocommerce-order-items").find(".inside").append(e.data.html),c.reloaded_items(),c.unblock()):window.alert(e.data.error),c.unblock()})},refund_items:function(){return u("div.wc-order-refund-items").slideDown(),u("div.wc-order-data-row-toggle").not("div.wc-order-refund-items").slideUp(),u("div.wc-order-totals-items").slideUp(),u("#woocommerce-order-items").find("div.refund").show(),u(".wc-order-edit-line-item .wc-order-edit-line-item-actions").hide(),!1},cancel:function(){return u("div.wc-order-data-row-toggle").not("div.wc-order-bulk-actions").slideUp(),u("div.wc-order-bulk-actions").slideDown(),u("div.wc-order-totals-items").slideDown(),u("#woocommerce-order-items").find("div.refund").hide(),u(".wc-order-edit-line-item .wc-order-edit-line-item-actions").show(),"true"===u(this).attr("data-reload")&&c.reload_items(),!1},add_item:function(){return u(this).WCBackboneModal({template:"wc-modal-add-products"}),!1},add_fee:function(){var e=window.prompt(woocommerce_admin_meta_boxes.i18n_add_fee);if(null!=e){c.block();var o=u.extend({},c.get_taxable_address(),{action:"woocommerce_add_order_fee",dataType:"json",order_id:woocommerce_admin_meta_boxes.post_id,security:woocommerce_admin_meta_boxes.order_item_nonce,amount:e});u.post(woocommerce_admin_meta_boxes.ajax_url,o,function(e){e.success?(u("#woocommerce-order-items").find(".inside").empty(),u("#woocommerce-order-items").find(".inside").append(e.data.html),c.reloaded_items(),c.unblock()):window.alert(e.data.error),c.unblock()})}return!1},add_shipping:function(){c.block();var e={action:"woocommerce_add_order_shipping",order_id:woocommerce_admin_meta_boxes.post_id,security:woocommerce_admin_meta_boxes.order_item_nonce,dataType:"json"};return u.post(woocommerce_admin_meta_boxes.ajax_url,e,function(e){e.success?u("table.woocommerce_order_items tbody#order_shipping_line_items").append(e.data.html):window.alert(e.data.error),c.unblock()}),!1},add_tax:function(){return u(this).WCBackboneModal({template:"wc-modal-add-tax"}),!1},edit_item:function(){return u(this).closest("tr").find(".view").hide(),u(this).closest("tr").find(".edit").show(),u(this).hide(),u("button.add-line-item").click(),u("button.cancel-action").attr("data-reload",!0),!1},delete_item:function(){if(window.confirm(woocommerce_admin_meta_boxes.remove_item_notice)){var e=u(this).closest("tr.item, tr.fee, tr.shipping").attr("data-order_item_id");c.block();var o=u.extend({},c.get_taxable_address(),{order_id:woocommerce_admin_meta_boxes.post_id,order_item_ids:e,action:"woocommerce_remove_order_item",security:woocommerce_admin_meta_boxes.order_item_nonce});"true"===u("button.cancel-action").attr("data-reload")&&(o.items=u("table.woocommerce_order_items :input[name], .wc-order-totals-items :input[name]").serialize()),u.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:o,type:"POST",success:function(e){e.success?(u("#woocommerce-order-items").find(".inside").empty(),u("#woocommerce-order-items").find(".inside").append(e.data.html),e.data.notes_html&&(u("ul.order_notes").empty(),u("ul.order_notes").append(u(e.data.notes_html).find("li"))),c.reloaded_items(),c.unblock()):window.alert(e.data.error),c.unblock()}})}return!1},delete_tax:function(){if(window.confirm(woocommerce_admin_meta_boxes.i18n_delete_tax)){c.block();var e={action:"woocommerce_remove_order_tax",rate_id:u(this).attr("data-rate_id"),order_id:woocommerce_admin_meta_boxes.post_id,security:woocommerce_admin_meta_boxes.order_item_nonce};u.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:e,type:"POST",success:function(e){e.success?(u("#woocommerce-order-items").find(".inside").empty(),u("#woocommerce-order-items").find(".inside").append(e.data.html),c.reloaded_items(),c.unblock()):window.alert(e.data.error),c.unblock()}})}return!1},get_taxable_address:function(){var e="",o="",t="",a="";return"shipping"===woocommerce_admin_meta_boxes.tax_based_on&&(e=u("#_shipping_country").val(),o=u("#_shipping_state").val(),t=u("#_shipping_postcode").val(),a=u("#_shipping_city").val()),"billing"!==woocommerce_admin_meta_boxes.tax_based_on&&e||(e=u("#_billing_country").val(),o=u("#_billing_state").val(),t=u("#_billing_postcode").val(),a=u("#_billing_city").val()),{country:e,state:o,postcode:t,city:a}},recalculate:function(){if(window.confirm(woocommerce_admin_meta_boxes.calc_totals)){c.block();var e=u.extend({},c.get_taxable_address(),{action:"woocommerce_calc_line_taxes",order_id:woocommerce_admin_meta_boxes.post_id,items:u("table.woocommerce_order_items :input[name], .wc-order-totals-items :input[name]").serialize(),security:woocommerce_admin_meta_boxes.calc_totals_nonce});u(document.body).trigger("order-totals-recalculate-before",e),u.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:e,type:"POST",success:function(e){u("#woocommerce-order-items").find(".inside").empty(),u("#woocommerce-order-items").find(".inside").append(e),c.reloaded_items(),c.unblock(),u(document.body).trigger("order-totals-recalculate-success",e)},complete:function(e){u(document.body).trigger("order-totals-recalculate-complete",e)}})}return!1},save_line_items:function(){var e={order_id:woocommerce_admin_meta_boxes.post_id,items:u("table.woocommerce_order_items :input[name], .wc-order-totals-items :input[name]").serialize(),action:"woocommerce_save_order_items",security:woocommerce_admin_meta_boxes.order_item_nonce};return c.block(),u.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:e,type:"POST",success:function(e){e.success?(u("#woocommerce-order-items").find(".inside").empty(),u("#woocommerce-order-items").find(".inside").append(e.data.html),e.data.notes_html&&(u("ul.order_notes").empty(),u("ul.order_notes").append(u(e.data.notes_html).find("li"))),c.reloaded_items(),c.unblock()):(c.unblock(),window.alert(e.data.error))}}),u(this).trigger("items_saved"),!1},refunds:{do_refund:function(){if(c.block(),window.confirm(woocommerce_admin_meta_boxes.i18n_do_refund)){var e=u("input#refund_amount").val(),o=u("input#refund_reason").val(),t=u("input#refunded_amount").val(),a={},i={},n={};u(".refund input.refund_order_item_qty").each(function(e,o){u(o).closest("tr").data("order_item_id")&&o.value&&(a[u(o).closest("tr").data("order_item_id")]=o.value)}),u(".refund input.refund_line_total").each(function(e,o){u(o).closest("tr").data("order_item_id")&&(i[u(o).closest("tr").data("order_item_id")]=accounting.unformat(o.value,woocommerce_admin.mon_decimal_point))}),u(".refund input.refund_line_tax").each(function(e,o){if(u(o).closest("tr").data("order_item_id")){var t=u(o).data("tax_id");n[u(o).closest("tr").data("order_item_id")]||(n[u(o).closest("tr").data("order_item_id")]={}),n[u(o).closest("tr").data("order_item_id")][t]=accounting.unformat(o.value,woocommerce_admin.mon_decimal_point)}});var r={action:"woocommerce_refund_line_items",order_id:woocommerce_admin_meta_boxes.post_id,refund_amount:e,refunded_amount:t,refund_reason:o,line_item_qtys:JSON.stringify(a,null,""),line_item_totals:JSON.stringify(i,null,""),line_item_tax_totals:JSON.stringify(n,null,""),api_refund:u(this).is(".do-api-refund"),restock_refunded_items:u("#restock_refunded_items:checked").length?"true":"false",security:woocommerce_admin_meta_boxes.order_item_nonce};u.post(woocommerce_admin_meta_boxes.ajax_url,r,function(e){!0===e.success?window.location.reload():(window.alert(e.data.error),c.reload_items(),c.unblock())})}else c.unblock()},delete_refund:function(){if(window.confirm(woocommerce_admin_meta_boxes.i18n_delete_refund)){var e=u(this).closest("tr.refund").attr("data-order_refund_id");c.block();var o={action:"woocommerce_delete_refund",refund_id:e,security:woocommerce_admin_meta_boxes.order_item_nonce};u.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:o,type:"POST",success:function(){c.reload_items()}})}return!1},input_changed:function(){var t=0;u(".woocommerce_order_items").find("tr.item, tr.fee, tr.shipping").each(function(){u(this).find(".refund input:not(.refund_order_item_qty)").each(function(e,o){t+=parseFloat(accounting.unformat(u(o).val()||0,woocommerce_admin.mon_decimal_point))})}),u("#refund_amount").val(accounting.formatNumber(t,woocommerce_admin_meta_boxes.currency_format_num_decimals,"",woocommerce_admin.mon_decimal_point)).change()},amount_changed:function(){var e=accounting.unformat(u(this).val(),woocommerce_admin.mon_decimal_point);u("button .wc-order-refund-amount .amount").text(accounting.formatMoney(e,{symbol:woocommerce_admin_meta_boxes.currency_format_symbol,decimal:woocommerce_admin_meta_boxes.currency_format_decimal_sep,thousand:woocommerce_admin_meta_boxes.currency_format_thousand_sep,precision:woocommerce_admin_meta_boxes.currency_format_num_decimals,format:woocommerce_admin_meta_boxes.currency_format}))},refund_quantity_changed:function(){var i=u(this).closest("tr.item"),n=i.find("input.quantity").val(),r=u(this).val(),e=u("input.line_total",i),o=u("input.refund_line_total",i),t=accounting.unformat(e.attr("data-total"),woocommerce_admin.mon_decimal_point)/n;o.val(parseFloat(accounting.formatNumber(t*r,woocommerce_admin_meta_boxes.rounding_precision,"")).toString().replace(".",woocommerce_admin.mon_decimal_point)).change(),u(".refund_line_tax",i).each(function(){var e=u(this),o=e.data("tax_id"),t=u('input.line_tax[data-tax_id="'+o+'"]',i),a=accounting.unformat(t.data("total_tax"),woocommerce_admin.mon_decimal_point)/n;0<a?e.val(parseFloat(accounting.formatNumber(a*r,woocommerce_admin_meta_boxes.rounding_precision,"")).toString().replace(".",woocommerce_admin.mon_decimal_point)).change():e.val(0).change()}),0<r?u("#restock_refunded_items").closest("tr").show():(u("#restock_refunded_items").closest("tr").hide(),u(".woocommerce_order_items input.refund_order_item_qty").each(function(){0<u(this).val()&&u("#restock_refunded_items").closest("tr").show()})),u(this).trigger("refund_quantity_changed")}},item_meta:{add:function(){var e=u(this).closest("tr.item, tr.shipping"),o=e.find("tbody.meta_items"),t=o.find("tr").length+1,a='<tr data-meta_id="0"><td><input type="text" maxlength="255" placeholder="'+woocommerce_admin_meta_boxes_order.placeholder_name+'" name="meta_key['+e.attr("data-order_item_id")+"][new-"+t+']" /><textarea placeholder="'+woocommerce_admin_meta_boxes_order.placeholder_value+'" name="meta_value['+e.attr("data-order_item_id")+"][new-"+t+']"></textarea></td><td width="1%"><button class="remove_order_item_meta button">×</button></td></tr>';return o.append(a),!1},remove:function(){if(window.confirm(woocommerce_admin_meta_boxes.remove_item_meta)){var e=u(this).closest("tr");e.find(":input").val(""),e.hide()}return!1}},backbone:{init:function(e,o){"wc-modal-add-products"===o&&(u(document.body).trigger("wc-enhanced-select-init"),u(this).on("change",".wc-product-search",function(){if(u(this).closest("tr").is(":last-child")){var e=u(this).closest("table.widefat").find("tbody"),o=e.find("tr").length,t=e.data("row").replace(/\[0\]/g,"["+o+"]");e.append("<tr>"+t+"</tr>"),u(document.body).trigger("wc-enhanced-select-init")}}))},response:function(e,o,t){if("wc-modal-add-tax"===o){var a=t.add_order_tax,i="";t.manual_tax_rate_id&&(i=t.manual_tax_rate_id),c.backbone.add_tax(a,i)}if("wc-modal-add-products"===o){var n=u(this).find("table.widefat").find("tbody").find("tr"),r=[];return u(n).each(function(){var e=u(this).find(':input[name="item_id"]').val(),o=u(this).find(':input[name="item_qty"]').val();r.push({id:e,qty:o||1})}),c.backbone.add_items(r)}},add_items:function(e){c.block();var o={action:"woocommerce_add_order_item",order_id:woocommerce_admin_meta_boxes.post_id,security:woocommerce_admin_meta_boxes.order_item_nonce,data:e};"true"===u("button.cancel-action").attr("data-reload")&&(o.items=u("table.woocommerce_order_items :input[name], .wc-order-totals-items :input[name]").serialize()),u.ajax({type:"POST",url:woocommerce_admin_meta_boxes.ajax_url,data:o,success:function(e){e.success?(u("#woocommerce-order-items").find(".inside").empty(),u("#woocommerce-order-items").find(".inside").append(e.data.html),e.data.notes_html&&(u("ul.order_notes").empty(),u("ul.order_notes").append(u(e.data.notes_html).find("li"))),c.reloaded_items(),c.unblock()):(c.unblock(),window.alert(e.data.error))},dataType:"json"})},add_tax:function(e,o){if(o&&(e=o),!e)return!1;var t=u(".order-tax-id").map(function(){return u(this).val()}).get();if(-1===u.inArray(e,t)){c.block();var a={action:"woocommerce_add_order_tax",rate_id:e,order_id:woocommerce_admin_meta_boxes.post_id,security:woocommerce_admin_meta_boxes.order_item_nonce};u.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:a,dataType:"json",type:"POST",success:function(e){e.success?(u("#woocommerce-order-items").find(".inside").empty(),u("#woocommerce-order-items").find(".inside").append(e.data.html),c.reloaded_items()):window.alert(e.data.error),c.unblock()}})}else window.alert(woocommerce_admin_meta_boxes.i18n_tax_rate_already_exists)}},stupidtable:{init:function(){u(".woocommerce_order_items").stupidtable(),u(".woocommerce_order_items").on("aftertablesort",this.add_arrows)},add_arrows:function(e,o){var t=u(this).find("th"),a="asc"===o.direction?"↑":"↓",i=o.column;t.find(".wc-arrow").remove(),t.eq(i).append('<span class="wc-arrow">'+a+"</span>")}}},e={init:function(){u("#woocommerce-order-notes").on("click","button.add_note",this.add_order_note).on("click","a.delete_note",this.delete_order_note)},add_order_note:function(){if(u("textarea#add_order_note").val()){u("#woocommerce-order-notes").block({message:null,overlayCSS:{background:"#fff",opacity:.6}});var e={action:"woocommerce_add_order_note",post_id:woocommerce_admin_meta_boxes.post_id,note:u("textarea#add_order_note").val(),note_type:u("select#order_note_type").val(),security:woocommerce_admin_meta_boxes.add_order_note_nonce};return u.post(woocommerce_admin_meta_boxes.ajax_url,e,function(e){u("ul.order_notes").prepend(e),u("#woocommerce-order-notes").unblock(),u("#add_order_note").val("")}),!1}},delete_order_note:function(){if(window.confirm(woocommerce_admin_meta_boxes.i18n_delete_note)){var e=u(this).closest("li.note");u(e).block({message:null,overlayCSS:{background:"#fff",opacity:.6}});var o={action:"woocommerce_delete_order_note",note_id:u(e).attr("rel"),security:woocommerce_admin_meta_boxes.delete_order_note_nonce};u.post(woocommerce_admin_meta_boxes.ajax_url,o,function(){u(e).remove()})}return!1}},o={init:function(){u(".order_download_permissions").on("click","button.grant_access",this.grant_access).on("click","button.revoke_access",this.revoke_access).on("click","#copy-download-link",this.copy_link).on("aftercopy","#copy-download-link",this.copy_success).on("aftercopyfailure","#copy-download-link",this.copy_fail)},grant_access:function(){var e=u("#grant_access_id").val();if(e){u(".order_download_permissions").block({message:null,overlayCSS:{background:"#fff",opacity:.6}});var o={action:"woocommerce_grant_access_to_download",product_ids:e,loop:u(".order_download_permissions .wc-metabox").length,order_id:woocommerce_admin_meta_boxes.post_id,security:woocommerce_admin_meta_boxes.grant_access_nonce};return u.post(woocommerce_admin_meta_boxes.ajax_url,o,function(e){e?u(".order_download_permissions .wc-metaboxes").append(e):window.alert(woocommerce_admin_meta_boxes.i18n_download_permission_fail),u(document.body).trigger("wc-init-datepickers"),u("#grant_access_id").val("").change(),u(".order_download_permissions").unblock()}),!1}},revoke_access:function(){if(window.confirm(woocommerce_admin_meta_boxes.i18n_permission_revoke)){var e=u(this).parent().parent(),o=u(this).attr("rel").split(",")[0],t=u(this).attr("rel").split(",")[1],a=u(this).data("permission_id");if(0<o){u(e).block({message:null,overlayCSS:{background:"#fff",opacity:.6}});var i={action:"woocommerce_revoke_access_to_download",product_id:o,download_id:t,permission_id:a,order_id:woocommerce_admin_meta_boxes.post_id,security:woocommerce_admin_meta_boxes.revoke_access_nonce};u.post(woocommerce_admin_meta_boxes.ajax_url,i,function(){u(e).fadeOut("300",function(){u(e).remove()})})}else u(e).fadeOut("300",function(){u(e).remove()})}return!1},copy_link:function(e){wcClearClipboard(),wcSetClipboard(u(this).attr("href"),u(this)),e.preventDefault()},copy_success:function(){u(this).tipTip({attribute:"data-tip",activation:"focus",fadeIn:50,fadeOut:50,delay:0}).focus()},copy_fail:function(){u(this).tipTip({attribute:"data-tip-failed",activation:"focus",fadeIn:50,fadeOut:50,delay:0}).focus()}};p.init(),c.init(),e.init(),o.init()});
|
1 |
+
jQuery(function(u){var p={states:null,init:function(){"undefined"!=typeof woocommerce_admin_meta_boxes_order&&"undefined"!=typeof woocommerce_admin_meta_boxes_order.countries&&(this.states=u.parseJSON(woocommerce_admin_meta_boxes_order.countries.replace(/"/g,'"'))),u(".js_field-country").selectWoo().change(this.change_country),u(".js_field-country").trigger("change",[!0]),u(document.body).on("change","select.js_field-state",this.change_state),u("#woocommerce-order-actions input, #woocommerce-order-actions a").click(function(){window.onbeforeunload=""}),u("a.edit_address").click(this.edit_address),u("a.billing-same-as-shipping").on("click",this.copy_billing_to_shipping),u("a.load_customer_billing").on("click",this.load_billing),u("a.load_customer_shipping").on("click",this.load_shipping),u("#customer_user").on("change",this.change_customer_user)},change_country:function(e,o){if(void 0===o&&(o=!1),null!==p.states){var t,a=u(this),i=a.val(),n=a.parents("div.edit_address").find(":input.js_field-state"),r=n.parent(),c=n.attr("name"),d=n.attr("id"),m=a.data("woocommerce.stickState-"+i)?a.data("woocommerce.stickState-"+i):n.val(),_=n.attr("placeholder");if(o&&a.data("woocommerce.stickState-"+i,m),r.show().find(".select2-container").remove(),u.isEmptyObject(p.states[i]))t=u('<input type="text" />').prop("id",d).prop("name",c).prop("placeholder",_).addClass("js_field-state").val(""),n.replaceWith(t);else{var s=p.states[i],l=u('<option value=""></option>').text(woocommerce_admin_meta_boxes_order.i18n_select_state_text);t=u("<select></select>").prop("id",d).prop("name",c).prop("placeholder",_).addClass("js_field-state select short").append(l),u.each(s,function(e){var o=u("<option></option>").prop("value",e).text(s[e]);t.append(o)}),t.val(m),n.replaceWith(t),t.show().selectWoo().hide().change()}u(document.body).trigger("contry-change.woocommerce",[i,u(this).closest("div")]),u(document.body).trigger("country-change.woocommerce",[i,u(this).closest("div")])}},change_state:function(){var e=u(this),o=e.val(),t=e.parents("div.edit_address").find(":input.js_field-country"),a=t.val();t.data("woocommerce.stickState-"+a,o)},init_tiptip:function(){u("#tiptip_holder").removeAttr("style"),u("#tiptip_arrow").removeAttr("style"),u(".tips").tipTip({attribute:"data-tip",fadeIn:50,fadeOut:50,delay:200})},edit_address:function(e){e.preventDefault();var o=u(this),t=o.closest(".order_data_column"),a=t.find("div.edit_address"),i=t.find("div.address"),n=a.find(".js_field-country"),r=a.find(".js_field-state");i.hide(),o.parent().find("a").toggle(),n.val()||(n.val(woocommerce_admin_meta_boxes_order.default_country).change(),r.val(woocommerce_admin_meta_boxes_order.default_state).change()),a.show()},change_customer_user:function(){u("#_billing_country").val()||(u("a.edit_address").click(),p.load_billing(!0),p.load_shipping(!0))},load_billing:function(e){if(!0===e||window.confirm(woocommerce_admin_meta_boxes.load_billing)){var o=u("#customer_user").val();if(!o)return window.alert(woocommerce_admin_meta_boxes.no_customer_selected),!1;var t={user_id:o,action:"woocommerce_get_customer_details",security:woocommerce_admin_meta_boxes.get_customer_details_nonce};u(this).closest("div.edit_address").block({message:null,overlayCSS:{background:"#fff",opacity:.6}}),u.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:t,type:"POST",success:function(e){e&&e.billing&&u.each(e.billing,function(e,o){u(":input#_billing_"+e).val(o).change()}),u("div.edit_address").unblock()}})}return!1},load_shipping:function(e){if(!0===e||window.confirm(woocommerce_admin_meta_boxes.load_shipping)){var o=u("#customer_user").val();if(!o)return window.alert(woocommerce_admin_meta_boxes.no_customer_selected),!1;var t={user_id:o,action:"woocommerce_get_customer_details",security:woocommerce_admin_meta_boxes.get_customer_details_nonce};u(this).closest("div.edit_address").block({message:null,overlayCSS:{background:"#fff",opacity:.6}}),u.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:t,type:"POST",success:function(e){e&&e.billing&&u.each(e.shipping,function(e,o){u(":input#_shipping_"+e).val(o).change()}),u("div.edit_address").unblock()}})}return!1},copy_billing_to_shipping:function(){return window.confirm(woocommerce_admin_meta_boxes.copy_billing)&&u('.order_data_column :input[name^="_billing_"]').each(function(){var e=u(this).attr("name");e=e.replace("_billing_","_shipping_"),u(":input#"+e).val(u(this).val()).change()}),!1}},c={init:function(){this.stupidtable.init(),u("#woocommerce-order-items").on("click","button.add-line-item",this.add_line_item).on("click","button.add-coupon",this.add_coupon).on("click","a.remove-coupon",this.remove_coupon).on("click","button.refund-items",this.refund_items).on("click",".cancel-action",this.cancel).on("click","button.add-order-item",this.add_item).on("click","button.add-order-fee",this.add_fee).on("click","button.add-order-shipping",this.add_shipping).on("click","button.add-order-tax",this.add_tax).on("click","button.save-action",this.save_line_items).on("click","a.delete-order-tax",this.delete_tax).on("click","button.calculate-action",this.recalculate).on("click","a.edit-order-item",this.edit_item).on("click","a.delete-order-item",this.delete_item).on("click",".delete_refund",this.refunds.delete_refund).on("click","button.do-api-refund, button.do-manual-refund",this.refunds.do_refund).on("change",".refund input.refund_line_total, .refund input.refund_line_tax",this.refunds.input_changed).on("change keyup",".wc-order-refund-items #refund_amount",this.refunds.amount_changed).on("change","input.refund_order_item_qty",this.refunds.refund_quantity_changed).on("change","input.quantity",this.quantity_changed).on("keyup change",".split-input :input",function(){var e=u(this).parent().prev().find(":input");e&&(""===e.val()||e.is(".match-total"))&&e.val(u(this).val()).addClass("match-total")}).on("keyup",".split-input :input",function(){u(this).removeClass("match-total")}).on("click","button.add_order_item_meta",this.item_meta.add).on("click","button.remove_order_item_meta",this.item_meta.remove).on("wc_order_items_reload",this.reload_items).on("wc_order_items_reloaded",this.reloaded_items),u(document.body).on("wc_backbone_modal_loaded",this.backbone.init).on("wc_backbone_modal_response",this.backbone.response)},block:function(){u("#woocommerce-order-items").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},unblock:function(){u("#woocommerce-order-items").unblock()},reload_items:function(){var e={order_id:woocommerce_admin_meta_boxes.post_id,action:"woocommerce_load_order_items",security:woocommerce_admin_meta_boxes.order_item_nonce};c.block(),u.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:e,type:"POST",success:function(e){u("#woocommerce-order-items").find(".inside").empty(),u("#woocommerce-order-items").find(".inside").append(e),c.reloaded_items(),c.unblock()}})},reloaded_items:function(){p.init_tiptip(),c.stupidtable.init()},quantity_changed:function(){var n=u(this).closest("tr.item"),r=u(this).val(),c=u(this).attr("data-qty"),e=u("input.line_total",n),o=u("input.line_subtotal",n),t=accounting.unformat(e.attr("data-total"),woocommerce_admin.mon_decimal_point)/c;e.val(parseFloat(accounting.formatNumber(t*r,woocommerce_admin_meta_boxes.rounding_precision,"")).toString().replace(".",woocommerce_admin.mon_decimal_point));var a=accounting.unformat(o.attr("data-subtotal"),woocommerce_admin.mon_decimal_point)/c;o.val(parseFloat(accounting.formatNumber(a*r,woocommerce_admin_meta_boxes.rounding_precision,"")).toString().replace(".",woocommerce_admin.mon_decimal_point)),u("input.line_tax",n).each(function(){var e=u(this),o=e.data("tax_id"),t=accounting.unformat(e.attr("data-total_tax"),woocommerce_admin.mon_decimal_point)/c,a=u('input.line_subtotal_tax[data-tax_id="'+o+'"]',n),i=accounting.unformat(a.attr("data-subtotal_tax"),woocommerce_admin.mon_decimal_point)/c;0<t&&e.val(parseFloat(accounting.formatNumber(t*r,woocommerce_admin_meta_boxes.rounding_precision,"")).toString().replace(".",woocommerce_admin.mon_decimal_point)),0<i&&a.val(parseFloat(accounting.formatNumber(i*r,woocommerce_admin_meta_boxes.rounding_precision,"")).toString().replace(".",woocommerce_admin.mon_decimal_point))}),u(this).trigger("quantity_changed")},add_line_item:function(){return u("div.wc-order-add-item").slideDown(),u("div.wc-order-data-row-toggle").not("div.wc-order-add-item").slideUp(),!1},add_coupon:function(){var e=window.prompt(woocommerce_admin_meta_boxes.i18n_apply_coupon);if(null!=e){c.block();var o=u("#customer_user").val(),t=u("#_billing_email").val(),a=u.extend({},c.get_taxable_address(),{action:"woocommerce_add_coupon_discount",dataType:"json",order_id:woocommerce_admin_meta_boxes.post_id,security:woocommerce_admin_meta_boxes.order_item_nonce,coupon:e,user_id:o,user_email:t});u.post(woocommerce_admin_meta_boxes.ajax_url,a,function(e){e.success?(u("#woocommerce-order-items").find(".inside").empty(),u("#woocommerce-order-items").find(".inside").append(e.data.html),c.reloaded_items(),c.unblock()):window.alert(e.data.error),c.unblock()})}return!1},remove_coupon:function(){var e=u(this);c.block();var o=u.extend({},c.get_taxable_address(),{action:"woocommerce_remove_order_coupon",dataType:"json",order_id:woocommerce_admin_meta_boxes.post_id,security:woocommerce_admin_meta_boxes.order_item_nonce,coupon:e.data("code")});u.post(woocommerce_admin_meta_boxes.ajax_url,o,function(e){e.success?(u("#woocommerce-order-items").find(".inside").empty(),u("#woocommerce-order-items").find(".inside").append(e.data.html),c.reloaded_items(),c.unblock()):window.alert(e.data.error),c.unblock()})},refund_items:function(){return u("div.wc-order-refund-items").slideDown(),u("div.wc-order-data-row-toggle").not("div.wc-order-refund-items").slideUp(),u("div.wc-order-totals-items").slideUp(),u("#woocommerce-order-items").find("div.refund").show(),u(".wc-order-edit-line-item .wc-order-edit-line-item-actions").hide(),!1},cancel:function(){return u("div.wc-order-data-row-toggle").not("div.wc-order-bulk-actions").slideUp(),u("div.wc-order-bulk-actions").slideDown(),u("div.wc-order-totals-items").slideDown(),u("#woocommerce-order-items").find("div.refund").hide(),u(".wc-order-edit-line-item .wc-order-edit-line-item-actions").show(),"true"===u(this).attr("data-reload")&&c.reload_items(),!1},add_item:function(){return u(this).WCBackboneModal({template:"wc-modal-add-products"}),!1},add_fee:function(){var e=window.prompt(woocommerce_admin_meta_boxes.i18n_add_fee);if(null!=e){c.block();var o=u.extend({},c.get_taxable_address(),{action:"woocommerce_add_order_fee",dataType:"json",order_id:woocommerce_admin_meta_boxes.post_id,security:woocommerce_admin_meta_boxes.order_item_nonce,amount:e});u.post(woocommerce_admin_meta_boxes.ajax_url,o,function(e){e.success?(u("#woocommerce-order-items").find(".inside").empty(),u("#woocommerce-order-items").find(".inside").append(e.data.html),c.reloaded_items(),c.unblock()):window.alert(e.data.error),c.unblock()})}return!1},add_shipping:function(){c.block();var e={action:"woocommerce_add_order_shipping",order_id:woocommerce_admin_meta_boxes.post_id,security:woocommerce_admin_meta_boxes.order_item_nonce,dataType:"json"};return u.post(woocommerce_admin_meta_boxes.ajax_url,e,function(e){e.success?u("table.woocommerce_order_items tbody#order_shipping_line_items").append(e.data.html):window.alert(e.data.error),c.unblock()}),!1},add_tax:function(){return u(this).WCBackboneModal({template:"wc-modal-add-tax"}),!1},edit_item:function(){return u(this).closest("tr").find(".view").hide(),u(this).closest("tr").find(".edit").show(),u(this).hide(),u("button.add-line-item").click(),u("button.cancel-action").attr("data-reload",!0),!1},delete_item:function(){if(window.confirm(woocommerce_admin_meta_boxes.remove_item_notice)){var e=u(this).closest("tr.item, tr.fee, tr.shipping").attr("data-order_item_id");c.block();var o=u.extend({},c.get_taxable_address(),{order_id:woocommerce_admin_meta_boxes.post_id,order_item_ids:e,action:"woocommerce_remove_order_item",security:woocommerce_admin_meta_boxes.order_item_nonce});"true"===u("button.cancel-action").attr("data-reload")&&(o.items=u("table.woocommerce_order_items :input[name], .wc-order-totals-items :input[name]").serialize()),u.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:o,type:"POST",success:function(e){e.success?(u("#woocommerce-order-items").find(".inside").empty(),u("#woocommerce-order-items").find(".inside").append(e.data.html),e.data.notes_html&&(u("ul.order_notes").empty(),u("ul.order_notes").append(u(e.data.notes_html).find("li"))),c.reloaded_items(),c.unblock()):window.alert(e.data.error),c.unblock()}})}return!1},delete_tax:function(){if(window.confirm(woocommerce_admin_meta_boxes.i18n_delete_tax)){c.block();var e={action:"woocommerce_remove_order_tax",rate_id:u(this).attr("data-rate_id"),order_id:woocommerce_admin_meta_boxes.post_id,security:woocommerce_admin_meta_boxes.order_item_nonce};u.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:e,type:"POST",success:function(e){e.success?(u("#woocommerce-order-items").find(".inside").empty(),u("#woocommerce-order-items").find(".inside").append(e.data.html),c.reloaded_items(),c.unblock()):window.alert(e.data.error),c.unblock()}})}return!1},get_taxable_address:function(){var e="",o="",t="",a="";return"shipping"===woocommerce_admin_meta_boxes.tax_based_on&&(e=u("#_shipping_country").val(),o=u("#_shipping_state").val(),t=u("#_shipping_postcode").val(),a=u("#_shipping_city").val()),"billing"!==woocommerce_admin_meta_boxes.tax_based_on&&e||(e=u("#_billing_country").val(),o=u("#_billing_state").val(),t=u("#_billing_postcode").val(),a=u("#_billing_city").val()),{country:e,state:o,postcode:t,city:a}},recalculate:function(){if(window.confirm(woocommerce_admin_meta_boxes.calc_totals)){c.block();var e=u.extend({},c.get_taxable_address(),{action:"woocommerce_calc_line_taxes",order_id:woocommerce_admin_meta_boxes.post_id,items:u("table.woocommerce_order_items :input[name], .wc-order-totals-items :input[name]").serialize(),security:woocommerce_admin_meta_boxes.calc_totals_nonce});u(document.body).trigger("order-totals-recalculate-before",e),u.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:e,type:"POST",success:function(e){u("#woocommerce-order-items").find(".inside").empty(),u("#woocommerce-order-items").find(".inside").append(e),c.reloaded_items(),c.unblock(),u(document.body).trigger("order-totals-recalculate-success",e)},complete:function(e){u(document.body).trigger("order-totals-recalculate-complete",e)}})}return!1},save_line_items:function(){var e={order_id:woocommerce_admin_meta_boxes.post_id,items:u("table.woocommerce_order_items :input[name], .wc-order-totals-items :input[name]").serialize(),action:"woocommerce_save_order_items",security:woocommerce_admin_meta_boxes.order_item_nonce};return c.block(),u.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:e,type:"POST",success:function(e){e.success?(u("#woocommerce-order-items").find(".inside").empty(),u("#woocommerce-order-items").find(".inside").append(e.data.html),e.data.notes_html&&(u("ul.order_notes").empty(),u("ul.order_notes").append(u(e.data.notes_html).find("li"))),c.reloaded_items(),c.unblock()):(c.unblock(),window.alert(e.data.error))}}),u(this).trigger("items_saved"),!1},refunds:{do_refund:function(){if(c.block(),window.confirm(woocommerce_admin_meta_boxes.i18n_do_refund)){var e=u("input#refund_amount").val(),o=u("input#refund_reason").val(),t=u("input#refunded_amount").val(),a={},i={},n={};u(".refund input.refund_order_item_qty").each(function(e,o){u(o).closest("tr").data("order_item_id")&&o.value&&(a[u(o).closest("tr").data("order_item_id")]=o.value)}),u(".refund input.refund_line_total").each(function(e,o){u(o).closest("tr").data("order_item_id")&&(i[u(o).closest("tr").data("order_item_id")]=accounting.unformat(o.value,woocommerce_admin.mon_decimal_point))}),u(".refund input.refund_line_tax").each(function(e,o){if(u(o).closest("tr").data("order_item_id")){var t=u(o).data("tax_id");n[u(o).closest("tr").data("order_item_id")]||(n[u(o).closest("tr").data("order_item_id")]={}),n[u(o).closest("tr").data("order_item_id")][t]=accounting.unformat(o.value,woocommerce_admin.mon_decimal_point)}});var r={action:"woocommerce_refund_line_items",order_id:woocommerce_admin_meta_boxes.post_id,refund_amount:e,refunded_amount:t,refund_reason:o,line_item_qtys:JSON.stringify(a,null,""),line_item_totals:JSON.stringify(i,null,""),line_item_tax_totals:JSON.stringify(n,null,""),api_refund:u(this).is(".do-api-refund"),restock_refunded_items:u("#restock_refunded_items:checked").length?"true":"false",security:woocommerce_admin_meta_boxes.order_item_nonce};u.post(woocommerce_admin_meta_boxes.ajax_url,r,function(e){!0===e.success?window.location.reload():(window.alert(e.data.error),c.reload_items(),c.unblock())})}else c.unblock()},delete_refund:function(){if(window.confirm(woocommerce_admin_meta_boxes.i18n_delete_refund)){var e=u(this).closest("tr.refund").attr("data-order_refund_id");c.block();var o={action:"woocommerce_delete_refund",refund_id:e,security:woocommerce_admin_meta_boxes.order_item_nonce};u.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:o,type:"POST",success:function(){c.reload_items()}})}return!1},input_changed:function(){var t=0;u(".woocommerce_order_items").find("tr.item, tr.fee, tr.shipping").each(function(){u(this).find(".refund input:not(.refund_order_item_qty)").each(function(e,o){t+=parseFloat(accounting.unformat(u(o).val()||0,woocommerce_admin.mon_decimal_point))})}),u("#refund_amount").val(accounting.formatNumber(t,woocommerce_admin_meta_boxes.currency_format_num_decimals,"",woocommerce_admin.mon_decimal_point)).change()},amount_changed:function(){var e=accounting.unformat(u(this).val(),woocommerce_admin.mon_decimal_point);u("button .wc-order-refund-amount .amount").text(accounting.formatMoney(e,{symbol:woocommerce_admin_meta_boxes.currency_format_symbol,decimal:woocommerce_admin_meta_boxes.currency_format_decimal_sep,thousand:woocommerce_admin_meta_boxes.currency_format_thousand_sep,precision:woocommerce_admin_meta_boxes.currency_format_num_decimals,format:woocommerce_admin_meta_boxes.currency_format}))},refund_quantity_changed:function(){var i=u(this).closest("tr.item"),n=i.find("input.quantity").val(),r=u(this).val(),e=u("input.line_total",i),o=u("input.refund_line_total",i),t=accounting.unformat(e.attr("data-total"),woocommerce_admin.mon_decimal_point)/n;o.val(parseFloat(accounting.formatNumber(t*r,woocommerce_admin_meta_boxes.rounding_precision,"")).toString().replace(".",woocommerce_admin.mon_decimal_point)).change(),u(".refund_line_tax",i).each(function(){var e=u(this),o=e.data("tax_id"),t=u('input.line_tax[data-tax_id="'+o+'"]',i),a=accounting.unformat(t.data("total_tax"),woocommerce_admin.mon_decimal_point)/n;0<a?e.val(parseFloat(accounting.formatNumber(a*r,woocommerce_admin_meta_boxes.rounding_precision,"")).toString().replace(".",woocommerce_admin.mon_decimal_point)).change():e.val(0).change()}),0<r?u("#restock_refunded_items").closest("tr").show():(u("#restock_refunded_items").closest("tr").hide(),u(".woocommerce_order_items input.refund_order_item_qty").each(function(){0<u(this).val()&&u("#restock_refunded_items").closest("tr").show()})),u(this).trigger("refund_quantity_changed")}},item_meta:{add:function(){var e=u(this).closest("tr.item, tr.shipping"),o=e.find("tbody.meta_items"),t=o.find("tr").length+1,a='<tr data-meta_id="0"><td><input type="text" maxlength="255" placeholder="'+woocommerce_admin_meta_boxes_order.placeholder_name+'" name="meta_key['+e.attr("data-order_item_id")+"][new-"+t+']" /><textarea placeholder="'+woocommerce_admin_meta_boxes_order.placeholder_value+'" name="meta_value['+e.attr("data-order_item_id")+"][new-"+t+']"></textarea></td><td width="1%"><button class="remove_order_item_meta button">×</button></td></tr>';return o.append(a),!1},remove:function(){if(window.confirm(woocommerce_admin_meta_boxes.remove_item_meta)){var e=u(this).closest("tr");e.find(":input").val(""),e.hide()}return!1}},backbone:{init:function(e,o){"wc-modal-add-products"===o&&(u(document.body).trigger("wc-enhanced-select-init"),u(this).on("change",".wc-product-search",function(){if(u(this).closest("tr").is(":last-child")){var e=u(this).closest("table.widefat").find("tbody"),o=e.find("tr").length,t=e.data("row").replace(/\[0\]/g,"["+o+"]");e.append("<tr>"+t+"</tr>"),u(document.body).trigger("wc-enhanced-select-init")}}))},response:function(e,o,t){if("wc-modal-add-tax"===o){var a=t.add_order_tax,i="";t.manual_tax_rate_id&&(i=t.manual_tax_rate_id),c.backbone.add_tax(a,i)}if("wc-modal-add-products"===o){var n=u(this).find("table.widefat").find("tbody").find("tr"),r=[];return u(n).each(function(){var e=u(this).find(':input[name="item_id"]').val(),o=u(this).find(':input[name="item_qty"]').val();r.push({id:e,qty:o||1})}),c.backbone.add_items(r)}},add_items:function(e){c.block();var o={action:"woocommerce_add_order_item",order_id:woocommerce_admin_meta_boxes.post_id,security:woocommerce_admin_meta_boxes.order_item_nonce,data:e};"true"===u("button.cancel-action").attr("data-reload")&&(o.items=u("table.woocommerce_order_items :input[name], .wc-order-totals-items :input[name]").serialize()),u.ajax({type:"POST",url:woocommerce_admin_meta_boxes.ajax_url,data:o,success:function(e){e.success?(u("#woocommerce-order-items").find(".inside").empty(),u("#woocommerce-order-items").find(".inside").append(e.data.html),e.data.notes_html&&(u("ul.order_notes").empty(),u("ul.order_notes").append(u(e.data.notes_html).find("li"))),c.reloaded_items(),c.unblock()):(c.unblock(),window.alert(e.data.error))},dataType:"json"})},add_tax:function(e,o){if(o&&(e=o),!e)return!1;var t=u(".order-tax-id").map(function(){return u(this).val()}).get();if(-1===u.inArray(e,t)){c.block();var a={action:"woocommerce_add_order_tax",rate_id:e,order_id:woocommerce_admin_meta_boxes.post_id,security:woocommerce_admin_meta_boxes.order_item_nonce};u.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:a,dataType:"json",type:"POST",success:function(e){e.success?(u("#woocommerce-order-items").find(".inside").empty(),u("#woocommerce-order-items").find(".inside").append(e.data.html),c.reloaded_items()):window.alert(e.data.error),c.unblock()}})}else window.alert(woocommerce_admin_meta_boxes.i18n_tax_rate_already_exists)}},stupidtable:{init:function(){u(".woocommerce_order_items").stupidtable(),u(".woocommerce_order_items").on("aftertablesort",this.add_arrows)},add_arrows:function(e,o){var t=u(this).find("th"),a="asc"===o.direction?"↑":"↓",i=o.column;t.find(".wc-arrow").remove(),t.eq(i).append('<span class="wc-arrow">'+a+"</span>")}}},e={init:function(){u("#woocommerce-order-notes").on("click","button.add_note",this.add_order_note).on("click","a.delete_note",this.delete_order_note)},add_order_note:function(){if(u("textarea#add_order_note").val()){u("#woocommerce-order-notes").block({message:null,overlayCSS:{background:"#fff",opacity:.6}});var e={action:"woocommerce_add_order_note",post_id:woocommerce_admin_meta_boxes.post_id,note:u("textarea#add_order_note").val(),note_type:u("select#order_note_type").val(),security:woocommerce_admin_meta_boxes.add_order_note_nonce};return u.post(woocommerce_admin_meta_boxes.ajax_url,e,function(e){u("ul.order_notes").prepend(e),u("#woocommerce-order-notes").unblock(),u("#add_order_note").val("")}),!1}},delete_order_note:function(){if(window.confirm(woocommerce_admin_meta_boxes.i18n_delete_note)){var e=u(this).closest("li.note");u(e).block({message:null,overlayCSS:{background:"#fff",opacity:.6}});var o={action:"woocommerce_delete_order_note",note_id:u(e).attr("rel"),security:woocommerce_admin_meta_boxes.delete_order_note_nonce};u.post(woocommerce_admin_meta_boxes.ajax_url,o,function(){u(e).remove()})}return!1}},o={init:function(){u(".order_download_permissions").on("click","button.grant_access",this.grant_access).on("click","button.revoke_access",this.revoke_access).on("click","#copy-download-link",this.copy_link).on("aftercopy","#copy-download-link",this.copy_success).on("aftercopyfailure","#copy-download-link",this.copy_fail)},grant_access:function(){var e=u("#grant_access_id").val();if(e){u(".order_download_permissions").block({message:null,overlayCSS:{background:"#fff",opacity:.6}});var o={action:"woocommerce_grant_access_to_download",product_ids:e,loop:u(".order_download_permissions .wc-metabox").length,order_id:woocommerce_admin_meta_boxes.post_id,security:woocommerce_admin_meta_boxes.grant_access_nonce};return u.post(woocommerce_admin_meta_boxes.ajax_url,o,function(e){e?u(".order_download_permissions .wc-metaboxes").append(e):window.alert(woocommerce_admin_meta_boxes.i18n_download_permission_fail),u(document.body).trigger("wc-init-datepickers"),u("#grant_access_id").val("").change(),u(".order_download_permissions").unblock()}),!1}},revoke_access:function(){if(window.confirm(woocommerce_admin_meta_boxes.i18n_permission_revoke)){var e=u(this).parent().parent(),o=u(this).attr("rel").split(",")[0],t=u(this).attr("rel").split(",")[1],a=u(this).data("permission_id");if(0<o){u(e).block({message:null,overlayCSS:{background:"#fff",opacity:.6}});var i={action:"woocommerce_revoke_access_to_download",product_id:o,download_id:t,permission_id:a,order_id:woocommerce_admin_meta_boxes.post_id,security:woocommerce_admin_meta_boxes.revoke_access_nonce};u.post(woocommerce_admin_meta_boxes.ajax_url,i,function(){u(e).fadeOut("300",function(){u(e).remove()})})}else u(e).fadeOut("300",function(){u(e).remove()})}return!1},copy_link:function(e){wcClearClipboard(),wcSetClipboard(u(this).attr("href"),u(this)),e.preventDefault()},copy_success:function(){u(this).tipTip({attribute:"data-tip",activation:"focus",fadeIn:50,fadeOut:50,delay:0}).focus()},copy_fail:function(){u(this).tipTip({attribute:"data-tip-failed",activation:"focus",fadeIn:50,fadeOut:50,delay:0}).focus()}};p.init(),c.init(),e.init(),o.init()});
|
i18n/languages/woocommerce.pot
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
# This file is distributed under the same license as the WooCommerce package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: WooCommerce 3.6.
|
6 |
"Report-Msgid-Bugs-To: https://github.com/woocommerce/woocommerce/issues\n"
|
7 |
-
"POT-Creation-Date: 2019-05-
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
@@ -5953,7 +5953,7 @@ msgid "Invalid coupon code"
|
|
5953 |
msgstr ""
|
5954 |
|
5955 |
#: includes/abstracts/abstract-wc-order.php:939 includes/class-wc-ajax.php:1128
|
5956 |
-
#: includes/class-wc-ajax.php:
|
5957 |
msgid "Invalid coupon"
|
5958 |
msgstr ""
|
5959 |
|
@@ -5962,7 +5962,7 @@ msgstr ""
|
|
5962 |
msgid "Coupon code already applied!"
|
5963 |
msgstr ""
|
5964 |
|
5965 |
-
#: includes/abstracts/abstract-wc-order.php:
|
5966 |
#: includes/admin/list-tables/class-wc-admin-list-table-orders.php:266
|
5967 |
#: includes/admin/list-tables/class-wc-admin-list-table-orders.php:318
|
5968 |
#: includes/admin/list-tables/class-wc-admin-list-table-orders.php:335
|
@@ -5973,26 +5973,26 @@ msgstr ""
|
|
5973 |
msgid "via %s"
|
5974 |
msgstr ""
|
5975 |
|
5976 |
-
#: includes/abstracts/abstract-wc-order.php:
|
5977 |
#: includes/class-wc-cart.php:1396 includes/class-wc-product-grouped.php:120
|
5978 |
msgid "Free!"
|
5979 |
msgstr ""
|
5980 |
|
5981 |
-
#: includes/abstracts/abstract-wc-order.php:
|
5982 |
msgid "Subtotal:"
|
5983 |
msgstr ""
|
5984 |
|
5985 |
-
#: includes/abstracts/abstract-wc-order.php:
|
5986 |
#: includes/admin/meta-boxes/views/html-order-items.php:146
|
5987 |
msgid "Discount:"
|
5988 |
msgstr ""
|
5989 |
|
5990 |
-
#: includes/abstracts/abstract-wc-order.php:
|
5991 |
#: includes/admin/meta-boxes/views/html-order-items.php:158
|
5992 |
msgid "Shipping:"
|
5993 |
msgstr ""
|
5994 |
|
5995 |
-
#: includes/abstracts/abstract-wc-order.php:
|
5996 |
#: templates/checkout/order-receipt.php:33 templates/checkout/thankyou.php:62
|
5997 |
msgid "Total:"
|
5998 |
msgstr ""
|
@@ -7742,7 +7742,7 @@ msgstr ""
|
|
7742 |
msgid "Reviews"
|
7743 |
msgstr ""
|
7744 |
|
7745 |
-
#: includes/admin/class-wc-admin-notices.php:
|
7746 |
#: includes/admin/class-wc-admin-status.php:296
|
7747 |
#: includes/admin/class-wc-admin-status.php:315
|
7748 |
#: includes/admin/class-wc-admin-status.php:331
|
@@ -7750,7 +7750,7 @@ msgstr ""
|
|
7750 |
msgid "Action failed. Please refresh the page and retry."
|
7751 |
msgstr ""
|
7752 |
|
7753 |
-
#: includes/admin/class-wc-admin-notices.php:
|
7754 |
#: includes/emails/class-wc-email.php:837
|
7755 |
msgid "You don’t have permission to do this."
|
7756 |
msgstr ""
|
@@ -7936,6 +7936,7 @@ msgstr ""
|
|
7936 |
#: includes/admin/views/html-notice-secure-connection.php:12
|
7937 |
#: includes/admin/views/html-notice-template-check.php:15
|
7938 |
#: includes/admin/views/html-notice-updated.php:14
|
|
|
7939 |
#: includes/wc-template-functions.php:1021
|
7940 |
msgid "Dismiss"
|
7941 |
msgstr ""
|
@@ -10775,7 +10776,7 @@ msgstr[1] ""
|
|
10775 |
#: includes/admin/list-tables/class-wc-admin-list-table-orders.php:751
|
10776 |
#: includes/admin/meta-boxes/class-wc-meta-box-order-data.php:296
|
10777 |
#: includes/admin/settings/views/html-keys-edit.php:43
|
10778 |
-
#: includes/class-wc-ajax.php:
|
10779 |
#. translators: 1: user display name 2: user ID 3: user email
|
10780 |
#. translators: $1: customer name, $2 customer id, $3: customer email
|
10781 |
msgid "%1$s (#%2$s – %3$s)"
|
@@ -11586,7 +11587,7 @@ msgstr ""
|
|
11586 |
#: includes/admin/views/html-admin-page-status-report.php:597
|
11587 |
#: includes/admin/views/html-admin-page-status-report.php:649
|
11588 |
#: includes/admin/views/html-admin-page-status-report.php:707
|
11589 |
-
#: includes/class-wc-ajax.php:
|
11590 |
#. translators: %s: note author
|
11591 |
#. translators: %s: plugin author
|
11592 |
#. translators: %s: note author
|
@@ -11594,7 +11595,7 @@ msgid "by %s"
|
|
11594 |
msgstr ""
|
11595 |
|
11596 |
#: includes/admin/meta-boxes/views/html-order-notes.php:37
|
11597 |
-
#: includes/class-wc-ajax.php:
|
11598 |
msgid "Delete note"
|
11599 |
msgstr ""
|
11600 |
|
@@ -14278,7 +14279,7 @@ msgid "Generate API key"
|
|
14278 |
msgstr ""
|
14279 |
|
14280 |
#: includes/admin/settings/views/html-keys-edit.php:119
|
14281 |
-
#: includes/class-wc-ajax.php:
|
14282 |
msgid "Revoke key"
|
14283 |
msgstr ""
|
14284 |
|
@@ -15798,6 +15799,20 @@ msgid ""
|
|
15798 |
"process may take a little while, so please be patient."
|
15799 |
msgstr ""
|
15800 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15801 |
#: includes/admin/views/html-report-by-date.php:22
|
15802 |
#. translators: 1: start date 2: end date
|
15803 |
msgid "From %1$s to %2$s"
|
@@ -16274,7 +16289,7 @@ msgstr ""
|
|
16274 |
#: includes/api/v2/class-wc-rest-order-refunds-v2-controller.php:191
|
16275 |
#: includes/api/v2/class-wc-rest-order-refunds-v2-controller.php:273
|
16276 |
#: includes/wc-core-functions.php:146 includes/wc-order-functions.php:507
|
16277 |
-
#: includes/wc-order-functions.php:
|
16278 |
msgid "Invalid order ID."
|
16279 |
msgstr ""
|
16280 |
|
@@ -16341,7 +16356,7 @@ msgstr ""
|
|
16341 |
msgid "Coupon code is required."
|
16342 |
msgstr ""
|
16343 |
|
16344 |
-
#: includes/api/class-wc-rest-orders-controller.php:
|
16345 |
#: includes/api/legacy/class-wc-rest-legacy-orders-controller.php:249
|
16346 |
#: includes/api/legacy/v2/class-wc-api-orders.php:388
|
16347 |
#: includes/api/legacy/v2/class-wc-api-orders.php:535
|
@@ -16352,7 +16367,7 @@ msgstr ""
|
|
16352 |
msgid "Customer ID is invalid."
|
16353 |
msgstr ""
|
16354 |
|
16355 |
-
#: includes/api/class-wc-rest-orders-controller.php:
|
16356 |
msgid "Limit result set to orders which have specific statuses."
|
16357 |
msgstr ""
|
16358 |
|
@@ -17871,7 +17886,7 @@ msgstr ""
|
|
17871 |
#: includes/api/legacy/v3/class-wc-api-resource.php:394
|
17872 |
#: includes/api/legacy/v3/class-wc-api-taxes.php:354
|
17873 |
#: includes/api/legacy/v3/class-wc-api-taxes.php:665
|
17874 |
-
#: includes/class-wc-ajax.php:
|
17875 |
#. translators: %s item name.
|
17876 |
msgid "Deleted %s"
|
17877 |
msgstr ""
|
@@ -20564,7 +20579,7 @@ msgstr ""
|
|
20564 |
#: includes/class-wc-ajax.php:866 includes/class-wc-ajax.php:873
|
20565 |
#: includes/class-wc-ajax.php:967 includes/class-wc-ajax.php:1029
|
20566 |
#: includes/class-wc-ajax.php:1071 includes/class-wc-ajax.php:1124
|
20567 |
-
#: includes/class-wc-ajax.php:
|
20568 |
msgid "Invalid order"
|
20569 |
msgstr ""
|
20570 |
|
@@ -20586,60 +20601,60 @@ msgstr ""
|
|
20586 |
msgid "Invalid rate"
|
20587 |
msgstr ""
|
20588 |
|
20589 |
-
#: includes/class-wc-ajax.php:
|
20590 |
msgid "Invalid items"
|
20591 |
msgstr ""
|
20592 |
|
20593 |
-
#: includes/class-wc-ajax.php:
|
20594 |
#. translators: %1$s: item name %2$s: stock change
|
20595 |
msgid "Deleted %1$s and adjusted stock (%2$s)"
|
20596 |
msgstr ""
|
20597 |
|
20598 |
-
#: includes/class-wc-ajax.php:
|
20599 |
#. translators: $1: Date created, $2 Time created
|
20600 |
msgid "added on %1$s at %2$s"
|
20601 |
msgstr ""
|
20602 |
|
20603 |
-
#: includes/class-wc-ajax.php:
|
20604 |
#. Translators: %d stock amount
|
20605 |
msgid "Stock: %d"
|
20606 |
msgstr ""
|
20607 |
|
20608 |
-
#: includes/class-wc-ajax.php:
|
20609 |
msgid "Invalid refund amount"
|
20610 |
msgstr ""
|
20611 |
|
20612 |
-
#: includes/class-wc-ajax.php:
|
20613 |
msgid "Error processing refund. Please try again."
|
20614 |
msgstr ""
|
20615 |
|
20616 |
-
#: includes/class-wc-ajax.php:
|
20617 |
msgid "Description is missing."
|
20618 |
msgstr ""
|
20619 |
|
20620 |
-
#: includes/class-wc-ajax.php:
|
20621 |
msgid "User is missing."
|
20622 |
msgstr ""
|
20623 |
|
20624 |
-
#: includes/class-wc-ajax.php:
|
20625 |
msgid "Permissions is missing."
|
20626 |
msgstr ""
|
20627 |
|
20628 |
-
#: includes/class-wc-ajax.php:
|
20629 |
msgid "You do not have permission to assign API Keys to the selected user."
|
20630 |
msgstr ""
|
20631 |
|
20632 |
-
#: includes/class-wc-ajax.php:
|
20633 |
msgid "API Key updated successfully."
|
20634 |
msgstr ""
|
20635 |
|
20636 |
-
#: includes/class-wc-ajax.php:
|
20637 |
msgid ""
|
20638 |
"API Key generated successfully. Make sure to copy your new keys now as the "
|
20639 |
"secret key will be hidden once you leave this page."
|
20640 |
msgstr ""
|
20641 |
|
20642 |
-
#: includes/class-wc-ajax.php:
|
20643 |
msgid "Dismiss this notice."
|
20644 |
msgstr ""
|
20645 |
|
@@ -24770,7 +24785,7 @@ msgid ""
|
|
24770 |
"apologize for any inconvenience caused."
|
24771 |
msgstr ""
|
24772 |
|
24773 |
-
#: includes/shortcodes/class-wc-shortcode-checkout.php:
|
24774 |
msgid ""
|
24775 |
"The order totals have been updated. Please confirm your order by pressing "
|
24776 |
"the \"Place order\" button at the bottom of the page."
|
@@ -25627,12 +25642,16 @@ msgid "Item #%1$s stock increased from %2$s to %3$s."
|
|
25627 |
msgstr ""
|
25628 |
|
25629 |
#: includes/wc-order-functions.php:775
|
|
|
|
|
|
|
|
|
25630 |
msgid ""
|
25631 |
"Order status set to refunded. To return funds to the customer you will need "
|
25632 |
"to issue a refund through your payment gateway."
|
25633 |
msgstr ""
|
25634 |
|
25635 |
-
#: includes/wc-order-functions.php:
|
25636 |
msgid "Unpaid order cancelled - time limit reached."
|
25637 |
msgstr ""
|
25638 |
|
2 |
# This file is distributed under the same license as the WooCommerce package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: WooCommerce 3.6.4\n"
|
6 |
"Report-Msgid-Bugs-To: https://github.com/woocommerce/woocommerce/issues\n"
|
7 |
+
"POT-Creation-Date: 2019-05-27 18:49:33+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
5953 |
msgstr ""
|
5954 |
|
5955 |
#: includes/abstracts/abstract-wc-order.php:939 includes/class-wc-ajax.php:1128
|
5956 |
+
#: includes/class-wc-ajax.php:1191 includes/class-wc-discounts.php:247
|
5957 |
msgid "Invalid coupon"
|
5958 |
msgstr ""
|
5959 |
|
5962 |
msgid "Coupon code already applied!"
|
5963 |
msgstr ""
|
5964 |
|
5965 |
+
#: includes/abstracts/abstract-wc-order.php:1766
|
5966 |
#: includes/admin/list-tables/class-wc-admin-list-table-orders.php:266
|
5967 |
#: includes/admin/list-tables/class-wc-admin-list-table-orders.php:318
|
5968 |
#: includes/admin/list-tables/class-wc-admin-list-table-orders.php:335
|
5973 |
msgid "via %s"
|
5974 |
msgstr ""
|
5975 |
|
5976 |
+
#: includes/abstracts/abstract-wc-order.php:1771
|
5977 |
#: includes/class-wc-cart.php:1396 includes/class-wc-product-grouped.php:120
|
5978 |
msgid "Free!"
|
5979 |
msgstr ""
|
5980 |
|
5981 |
+
#: includes/abstracts/abstract-wc-order.php:1800
|
5982 |
msgid "Subtotal:"
|
5983 |
msgstr ""
|
5984 |
|
5985 |
+
#: includes/abstracts/abstract-wc-order.php:1815
|
5986 |
#: includes/admin/meta-boxes/views/html-order-items.php:146
|
5987 |
msgid "Discount:"
|
5988 |
msgstr ""
|
5989 |
|
5990 |
+
#: includes/abstracts/abstract-wc-order.php:1830
|
5991 |
#: includes/admin/meta-boxes/views/html-order-items.php:158
|
5992 |
msgid "Shipping:"
|
5993 |
msgstr ""
|
5994 |
|
5995 |
+
#: includes/abstracts/abstract-wc-order.php:1891
|
5996 |
#: templates/checkout/order-receipt.php:33 templates/checkout/thankyou.php:62
|
5997 |
msgid "Total:"
|
5998 |
msgstr ""
|
7742 |
msgid "Reviews"
|
7743 |
msgstr ""
|
7744 |
|
7745 |
+
#: includes/admin/class-wc-admin-notices.php:126
|
7746 |
#: includes/admin/class-wc-admin-status.php:296
|
7747 |
#: includes/admin/class-wc-admin-status.php:315
|
7748 |
#: includes/admin/class-wc-admin-status.php:331
|
7750 |
msgid "Action failed. Please refresh the page and retry."
|
7751 |
msgstr ""
|
7752 |
|
7753 |
+
#: includes/admin/class-wc-admin-notices.php:130
|
7754 |
#: includes/emails/class-wc-email.php:837
|
7755 |
msgid "You don’t have permission to do this."
|
7756 |
msgstr ""
|
7936 |
#: includes/admin/views/html-notice-secure-connection.php:12
|
7937 |
#: includes/admin/views/html-notice-template-check.php:15
|
7938 |
#: includes/admin/views/html-notice-updated.php:14
|
7939 |
+
#: includes/admin/views/html-notice-wc-admin.php:14
|
7940 |
#: includes/wc-template-functions.php:1021
|
7941 |
msgid "Dismiss"
|
7942 |
msgstr ""
|
10776 |
#: includes/admin/list-tables/class-wc-admin-list-table-orders.php:751
|
10777 |
#: includes/admin/meta-boxes/class-wc-meta-box-order-data.php:296
|
10778 |
#: includes/admin/settings/views/html-keys-edit.php:43
|
10779 |
+
#: includes/class-wc-ajax.php:1643
|
10780 |
#. translators: 1: user display name 2: user ID 3: user email
|
10781 |
#. translators: $1: customer name, $2 customer id, $3: customer email
|
10782 |
msgid "%1$s (#%2$s – %3$s)"
|
11587 |
#: includes/admin/views/html-admin-page-status-report.php:597
|
11588 |
#: includes/admin/views/html-admin-page-status-report.php:649
|
11589 |
#: includes/admin/views/html-admin-page-status-report.php:707
|
11590 |
+
#: includes/class-wc-ajax.php:1473 templates/content-widget-reviews.php:31
|
11591 |
#. translators: %s: note author
|
11592 |
#. translators: %s: plugin author
|
11593 |
#. translators: %s: note author
|
11595 |
msgstr ""
|
11596 |
|
11597 |
#: includes/admin/meta-boxes/views/html-order-notes.php:37
|
11598 |
+
#: includes/class-wc-ajax.php:1476
|
11599 |
msgid "Delete note"
|
11600 |
msgstr ""
|
11601 |
|
14279 |
msgstr ""
|
14280 |
|
14281 |
#: includes/admin/settings/views/html-keys-edit.php:119
|
14282 |
+
#: includes/class-wc-ajax.php:2004
|
14283 |
msgid "Revoke key"
|
14284 |
msgstr ""
|
14285 |
|
15799 |
"process may take a little while, so please be patient."
|
15800 |
msgstr ""
|
15801 |
|
15802 |
+
#: includes/admin/views/html-notice-wc-admin.php:17
|
15803 |
+
msgid ""
|
15804 |
+
"Test drive the future of WooCommerce. A quicker, javascript powered "
|
15805 |
+
"interface with exciting new features and reports."
|
15806 |
+
msgstr ""
|
15807 |
+
|
15808 |
+
#: includes/admin/views/html-notice-wc-admin.php:21
|
15809 |
+
msgid "Activate WooCommerce Admin"
|
15810 |
+
msgstr ""
|
15811 |
+
|
15812 |
+
#: includes/admin/views/html-notice-wc-admin.php:32
|
15813 |
+
msgid "Install WooCommerce Admin"
|
15814 |
+
msgstr ""
|
15815 |
+
|
15816 |
#: includes/admin/views/html-report-by-date.php:22
|
15817 |
#. translators: 1: start date 2: end date
|
15818 |
msgid "From %1$s to %2$s"
|
16289 |
#: includes/api/v2/class-wc-rest-order-refunds-v2-controller.php:191
|
16290 |
#: includes/api/v2/class-wc-rest-order-refunds-v2-controller.php:273
|
16291 |
#: includes/wc-core-functions.php:146 includes/wc-order-functions.php:507
|
16292 |
+
#: includes/wc-order-functions.php:1060
|
16293 |
msgid "Invalid order ID."
|
16294 |
msgstr ""
|
16295 |
|
16356 |
msgid "Coupon code is required."
|
16357 |
msgstr ""
|
16358 |
|
16359 |
+
#: includes/api/class-wc-rest-orders-controller.php:162
|
16360 |
#: includes/api/legacy/class-wc-rest-legacy-orders-controller.php:249
|
16361 |
#: includes/api/legacy/v2/class-wc-api-orders.php:388
|
16362 |
#: includes/api/legacy/v2/class-wc-api-orders.php:535
|
16367 |
msgid "Customer ID is invalid."
|
16368 |
msgstr ""
|
16369 |
|
16370 |
+
#: includes/api/class-wc-rest-orders-controller.php:279
|
16371 |
msgid "Limit result set to orders which have specific statuses."
|
16372 |
msgstr ""
|
16373 |
|
17886 |
#: includes/api/legacy/v3/class-wc-api-resource.php:394
|
17887 |
#: includes/api/legacy/v3/class-wc-api-taxes.php:354
|
17888 |
#: includes/api/legacy/v3/class-wc-api-taxes.php:665
|
17889 |
+
#: includes/class-wc-ajax.php:1271
|
17890 |
#. translators: %s item name.
|
17891 |
msgid "Deleted %s"
|
17892 |
msgstr ""
|
20579 |
#: includes/class-wc-ajax.php:866 includes/class-wc-ajax.php:873
|
20580 |
#: includes/class-wc-ajax.php:967 includes/class-wc-ajax.php:1029
|
20581 |
#: includes/class-wc-ajax.php:1071 includes/class-wc-ajax.php:1124
|
20582 |
+
#: includes/class-wc-ajax.php:1187 includes/class-wc-ajax.php:1228
|
20583 |
msgid "Invalid order"
|
20584 |
msgstr ""
|
20585 |
|
20601 |
msgid "Invalid rate"
|
20602 |
msgstr ""
|
20603 |
|
20604 |
+
#: includes/class-wc-ajax.php:1232
|
20605 |
msgid "Invalid items"
|
20606 |
msgstr ""
|
20607 |
|
20608 |
+
#: includes/class-wc-ajax.php:1268
|
20609 |
#. translators: %1$s: item name %2$s: stock change
|
20610 |
msgid "Deleted %1$s and adjusted stock (%2$s)"
|
20611 |
msgstr ""
|
20612 |
|
20613 |
+
#: includes/class-wc-ajax.php:1467
|
20614 |
#. translators: $1: Date created, $2 Time created
|
20615 |
msgid "added on %1$s at %2$s"
|
20616 |
msgstr ""
|
20617 |
|
20618 |
+
#: includes/class-wc-ajax.php:1541
|
20619 |
#. Translators: %d stock amount
|
20620 |
msgid "Stock: %d"
|
20621 |
msgstr ""
|
20622 |
|
20623 |
+
#: includes/class-wc-ajax.php:1821
|
20624 |
msgid "Invalid refund amount"
|
20625 |
msgstr ""
|
20626 |
|
20627 |
+
#: includes/class-wc-ajax.php:1825
|
20628 |
msgid "Error processing refund. Please try again."
|
20629 |
msgstr ""
|
20630 |
|
20631 |
+
#: includes/class-wc-ajax.php:1929
|
20632 |
msgid "Description is missing."
|
20633 |
msgstr ""
|
20634 |
|
20635 |
+
#: includes/class-wc-ajax.php:1932
|
20636 |
msgid "User is missing."
|
20637 |
msgstr ""
|
20638 |
|
20639 |
+
#: includes/class-wc-ajax.php:1935
|
20640 |
msgid "Permissions is missing."
|
20641 |
msgstr ""
|
20642 |
|
20643 |
+
#: includes/class-wc-ajax.php:1946
|
20644 |
msgid "You do not have permission to assign API Keys to the selected user."
|
20645 |
msgstr ""
|
20646 |
|
20647 |
+
#: includes/class-wc-ajax.php:1972
|
20648 |
msgid "API Key updated successfully."
|
20649 |
msgstr ""
|
20650 |
|
20651 |
+
#: includes/class-wc-ajax.php:2003
|
20652 |
msgid ""
|
20653 |
"API Key generated successfully. Make sure to copy your new keys now as the "
|
20654 |
"secret key will be hidden once you leave this page."
|
20655 |
msgstr ""
|
20656 |
|
20657 |
+
#: includes/class-wc-ajax.php:2090
|
20658 |
msgid "Dismiss this notice."
|
20659 |
msgstr ""
|
20660 |
|
24785 |
"apologize for any inconvenience caused."
|
24786 |
msgstr ""
|
24787 |
|
24788 |
+
#: includes/shortcodes/class-wc-shortcode-checkout.php:282
|
24789 |
msgid ""
|
24790 |
"The order totals have been updated. Please confirm your order by pressing "
|
24791 |
"the \"Place order\" button at the bottom of the page."
|
25642 |
msgstr ""
|
25643 |
|
25644 |
#: includes/wc-order-functions.php:775
|
25645 |
+
msgid "Order fully refunded."
|
25646 |
+
msgstr ""
|
25647 |
+
|
25648 |
+
#: includes/wc-order-functions.php:781
|
25649 |
msgid ""
|
25650 |
"Order status set to refunded. To return funds to the customer you will need "
|
25651 |
"to issue a refund through your payment gateway."
|
25652 |
msgstr ""
|
25653 |
|
25654 |
+
#: includes/wc-order-functions.php:907
|
25655 |
msgid "Unpaid order cancelled - time limit reached."
|
25656 |
msgstr ""
|
25657 |
|
includes/abstracts/abstract-wc-order.php
CHANGED
@@ -954,6 +954,21 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
|
954 |
return $applied;
|
955 |
}
|
956 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
957 |
$this->set_coupon_discount_amounts( $discounts );
|
958 |
$this->save();
|
959 |
|
954 |
return $applied;
|
955 |
}
|
956 |
|
957 |
+
// Check specific for guest checkouts here as well since WC_Cart handles that seperately in check_customer_coupons.
|
958 |
+
if ( 0 === $this->get_customer_id() ) {
|
959 |
+
$data_store = $coupon->get_data_store();
|
960 |
+
$usage_count = $data_store->get_usage_by_email( $coupon, $this->get_billing_email() );
|
961 |
+
if ( $usage_count >= $coupon->get_usage_limit_per_user() ) {
|
962 |
+
return new WP_Error(
|
963 |
+
'invalid_coupon',
|
964 |
+
$coupon->get_coupon_error( 106 ),
|
965 |
+
array(
|
966 |
+
'status' => 400,
|
967 |
+
)
|
968 |
+
);
|
969 |
+
}
|
970 |
+
}
|
971 |
+
|
972 |
$this->set_coupon_discount_amounts( $discounts );
|
973 |
$this->save();
|
974 |
|
includes/admin/class-wc-admin-notices.php
CHANGED
@@ -34,6 +34,7 @@ class WC_Admin_Notices {
|
|
34 |
'regenerating_thumbnails' => 'regenerating_thumbnails_notice',
|
35 |
'regenerating_lookup_table' => 'regenerating_lookup_table_notice',
|
36 |
'no_secure_connection' => 'secure_connection_notice',
|
|
|
37 |
);
|
38 |
|
39 |
/**
|
@@ -82,6 +83,7 @@ class WC_Admin_Notices {
|
|
82 |
if ( ! self::is_ssl() ) {
|
83 |
self::add_notice( 'no_secure_connection' );
|
84 |
}
|
|
|
85 |
self::add_notice( 'template_files' );
|
86 |
}
|
87 |
|
@@ -341,6 +343,36 @@ class WC_Admin_Notices {
|
|
341 |
include dirname( __FILE__ ) . '/views/html-notice-regenerating-lookup-table.php';
|
342 |
}
|
343 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
344 |
/**
|
345 |
* Determine if the store is running SSL.
|
346 |
*
|
34 |
'regenerating_thumbnails' => 'regenerating_thumbnails_notice',
|
35 |
'regenerating_lookup_table' => 'regenerating_lookup_table_notice',
|
36 |
'no_secure_connection' => 'secure_connection_notice',
|
37 |
+
'wc_admin' => 'wc_admin_feature_plugin_notice',
|
38 |
);
|
39 |
|
40 |
/**
|
83 |
if ( ! self::is_ssl() ) {
|
84 |
self::add_notice( 'no_secure_connection' );
|
85 |
}
|
86 |
+
self::add_wc_admin_feature_plugin_notice();
|
87 |
self::add_notice( 'template_files' );
|
88 |
}
|
89 |
|
343 |
include dirname( __FILE__ ) . '/views/html-notice-regenerating-lookup-table.php';
|
344 |
}
|
345 |
|
346 |
+
|
347 |
+
/**
|
348 |
+
* If on WordPress 5.0 or greater, inform users of WooCommerce Admin feature plugin.
|
349 |
+
*
|
350 |
+
* @since 3.6.4
|
351 |
+
* @todo Remove this notice and associated code once the feature plugin has been merged into core.
|
352 |
+
*/
|
353 |
+
public static function add_wc_admin_feature_plugin_notice() {
|
354 |
+
$wordpress_version = get_bloginfo( 'version' );
|
355 |
+
|
356 |
+
if ( version_compare( $wordpress_version, '5.0', '>=' ) ) {
|
357 |
+
self::add_notice( 'wc_admin' );
|
358 |
+
}
|
359 |
+
}
|
360 |
+
|
361 |
+
/**
|
362 |
+
* Notice to try WooCommerce Admin
|
363 |
+
*
|
364 |
+
* @since 3.6.4
|
365 |
+
* @todo Remove this notice and associated code once the feature plugin has been merged into core.
|
366 |
+
*/
|
367 |
+
public static function wc_admin_feature_plugin_notice() {
|
368 |
+
if ( get_user_meta( get_current_user_id(), 'dismissed_wc_admin_notice', true ) || self::is_plugin_active( 'woocommerce-admin/woocommerce-admin.php' ) ) {
|
369 |
+
self::remove_notice( 'wc_admin' );
|
370 |
+
return;
|
371 |
+
}
|
372 |
+
|
373 |
+
include dirname( __FILE__ ) . '/views/html-notice-wc-admin.php';
|
374 |
+
}
|
375 |
+
|
376 |
/**
|
377 |
* Determine if the store is running SSL.
|
378 |
*
|
includes/admin/views/html-notice-wc-admin.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Admin View: Notice - WooCommerce Admin Feature Plugin
|
4 |
+
*
|
5 |
+
* @package admin.
|
6 |
+
*/
|
7 |
+
|
8 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
9 |
+
exit;
|
10 |
+
}
|
11 |
+
|
12 |
+
?>
|
13 |
+
<div id="message" class="updated woocommerce-message woocommerce-admin-promo-messages">
|
14 |
+
<a class="woocommerce-message-close notice-dismiss" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wc-hide-notice', 'wc_admin' ), 'woocommerce_hide_notices_nonce', '_wc_notice_nonce' ) ); ?>"><?php esc_html_e( 'Dismiss', 'woocommerce' ); ?></a>
|
15 |
+
|
16 |
+
<p>
|
17 |
+
<?php echo wp_kses_post( __( 'Test drive the future of WooCommerce. A quicker, javascript powered interface with exciting new features and reports.', 'woocommerce' ) ); ?>
|
18 |
+
</p>
|
19 |
+
<?php if ( file_exists( WP_PLUGIN_DIR . '/woocommerce-admin/woocommerce-admin.php' ) && ! is_plugin_active( 'woocommerce-admin/woocommerce-admin.php' ) && current_user_can( 'activate_plugin', 'woocommerce-admin/woocommerce-admin.php' ) ) : ?>
|
20 |
+
<p>
|
21 |
+
<a href="<?php echo esc_url( wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=woocommerce-admin/woocommerce-admin.php&plugin_status=active' ), 'activate-plugin_woocommerce-admin/woocommerce-admin.php' ) ); ?>" class="button button-primary"><?php esc_html_e( 'Activate WooCommerce Admin', 'woocommerce' ); ?></a>
|
22 |
+
</p>
|
23 |
+
<?php else : ?>
|
24 |
+
<?php
|
25 |
+
if ( current_user_can( 'install_plugins' ) ) {
|
26 |
+
$url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=woocommerce-admin' ), 'install-plugin_woocommerce-admin' );
|
27 |
+
} else {
|
28 |
+
$url = 'https://wordpress.org/plugins/woocommerce-admin/';
|
29 |
+
}
|
30 |
+
?>
|
31 |
+
<p>
|
32 |
+
<a href="<?php echo esc_url( $url ); ?>" class="button button-primary"><?php esc_html_e( 'Install WooCommerce Admin', 'woocommerce' ); ?></a>
|
33 |
+
</p>
|
34 |
+
<?php endif; ?>
|
35 |
+
</div>
|
includes/api/class-wc-rest-orders-controller.php
CHANGED
@@ -144,6 +144,8 @@ class WC_REST_Orders_Controller extends WC_REST_Orders_V2_Controller {
|
|
144 |
* @return WC_Data|WP_Error
|
145 |
*/
|
146 |
protected function save_object( $request, $creating = false ) {
|
|
|
|
|
147 |
try {
|
148 |
$object = $this->prepare_object_for_database( $request, $creating );
|
149 |
|
@@ -196,12 +198,29 @@ class WC_REST_Orders_Controller extends WC_REST_Orders_V2_Controller {
|
|
196 |
|
197 |
return $this->get_object( $object->get_id() );
|
198 |
} catch ( WC_Data_Exception $e ) {
|
|
|
199 |
return new WP_Error( $e->getErrorCode(), $e->getMessage(), $e->getErrorData() );
|
200 |
} catch ( WC_REST_Exception $e ) {
|
|
|
201 |
return new WP_Error( $e->getErrorCode(), $e->getMessage(), array( 'status' => $e->getCode() ) );
|
202 |
}
|
203 |
}
|
204 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
205 |
/**
|
206 |
* Prepare objects query.
|
207 |
*
|
144 |
* @return WC_Data|WP_Error
|
145 |
*/
|
146 |
protected function save_object( $request, $creating = false ) {
|
147 |
+
$object = null;
|
148 |
+
|
149 |
try {
|
150 |
$object = $this->prepare_object_for_database( $request, $creating );
|
151 |
|
198 |
|
199 |
return $this->get_object( $object->get_id() );
|
200 |
} catch ( WC_Data_Exception $e ) {
|
201 |
+
$this->purge( $object, $creating );
|
202 |
return new WP_Error( $e->getErrorCode(), $e->getMessage(), $e->getErrorData() );
|
203 |
} catch ( WC_REST_Exception $e ) {
|
204 |
+
$this->purge( $object, $creating );
|
205 |
return new WP_Error( $e->getErrorCode(), $e->getMessage(), array( 'status' => $e->getCode() ) );
|
206 |
}
|
207 |
}
|
208 |
|
209 |
+
/**
|
210 |
+
* Purge object when creating.
|
211 |
+
*
|
212 |
+
* @param WC_Data $object Object data.
|
213 |
+
* @param bool $creating If is creating a new object.
|
214 |
+
* @return bool
|
215 |
+
*/
|
216 |
+
protected function purge( $object, $creating ) {
|
217 |
+
if ( $object instanceof WC_Data && $creating ) {
|
218 |
+
return $object->delete( true );
|
219 |
+
}
|
220 |
+
|
221 |
+
return false;
|
222 |
+
}
|
223 |
+
|
224 |
/**
|
225 |
* Prepare objects query.
|
226 |
*
|
includes/class-wc-ajax.php
CHANGED
@@ -1128,12 +1128,16 @@ class WC_AJAX {
|
|
1128 |
throw new Exception( __( 'Invalid coupon', 'woocommerce' ) );
|
1129 |
}
|
1130 |
|
1131 |
-
// Add user ID so validation for coupon limits works.
|
1132 |
-
$user_id_arg
|
|
|
1133 |
|
1134 |
if ( $user_id_arg ) {
|
1135 |
$order->set_customer_id( $user_id_arg );
|
1136 |
}
|
|
|
|
|
|
|
1137 |
|
1138 |
$result = $order->apply_coupon( wc_format_coupon_code( wp_unslash( $_POST['coupon'] ) ) ); // phpcs:ignore WordPress.Security.NonceVerification.NoNonceVerification, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
|
1139 |
|
1128 |
throw new Exception( __( 'Invalid coupon', 'woocommerce' ) );
|
1129 |
}
|
1130 |
|
1131 |
+
// Add user ID and/or email so validation for coupon limits works.
|
1132 |
+
$user_id_arg = isset( $_POST['user_id'] ) ? absint( $_POST['user_id'] ) : 0;
|
1133 |
+
$user_email_arg = isset( $_POST['user_email'] ) ? sanitize_email( wp_unslash( $_POST['user_email'] ) ) : '';
|
1134 |
|
1135 |
if ( $user_id_arg ) {
|
1136 |
$order->set_customer_id( $user_id_arg );
|
1137 |
}
|
1138 |
+
if ( $user_email_arg ) {
|
1139 |
+
$order->set_billing_email( $user_email_arg );
|
1140 |
+
}
|
1141 |
|
1142 |
$result = $order->apply_coupon( wc_format_coupon_code( wp_unslash( $_POST['coupon'] ) ) ); // phpcs:ignore WordPress.Security.NonceVerification.NoNonceVerification, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
|
1143 |
|
includes/class-wc-form-handler.php
CHANGED
@@ -690,7 +690,7 @@ class WC_Form_Handler {
|
|
690 |
$order_id = absint( $_GET['order_id'] );
|
691 |
$order = wc_get_order( $order_id );
|
692 |
$user_can_cancel = current_user_can( 'cancel_order', $order_id );
|
693 |
-
$order_can_cancel = $order->has_status( apply_filters( 'woocommerce_valid_order_statuses_for_cancel', array( 'pending', 'failed' ) ) );
|
694 |
$redirect = isset( $_GET['redirect'] ) ? wp_unslash( $_GET['redirect'] ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
|
695 |
|
696 |
if ( $user_can_cancel && $order_can_cancel && $order->get_id() === $order_id && hash_equals( $order->get_order_key(), $order_key ) ) {
|
690 |
$order_id = absint( $_GET['order_id'] );
|
691 |
$order = wc_get_order( $order_id );
|
692 |
$user_can_cancel = current_user_can( 'cancel_order', $order_id );
|
693 |
+
$order_can_cancel = $order->has_status( apply_filters( 'woocommerce_valid_order_statuses_for_cancel', array( 'pending', 'failed' ), $order ) );
|
694 |
$redirect = isset( $_GET['redirect'] ) ? wp_unslash( $_GET['redirect'] ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
|
695 |
|
696 |
if ( $user_can_cancel && $order_can_cancel && $order->get_id() === $order_id && hash_equals( $order->get_order_key(), $order_key ) ) {
|
includes/class-wc-structured-data.php
CHANGED
@@ -257,7 +257,7 @@ class WC_Structured_Data {
|
|
257 |
|
258 |
$markup_offer += array(
|
259 |
'priceCurrency' => $currency,
|
260 |
-
'availability' => '
|
261 |
'url' => $permalink,
|
262 |
'seller' => array(
|
263 |
'@type' => 'Organization',
|
257 |
|
258 |
$markup_offer += array(
|
259 |
'priceCurrency' => $currency,
|
260 |
+
'availability' => 'http://schema.org/' . ( $product->is_in_stock() ? 'InStock' : 'OutOfStock' ),
|
261 |
'url' => $permalink,
|
262 |
'seller' => array(
|
263 |
'@type' => 'Organization',
|
includes/class-woocommerce.php
CHANGED
@@ -20,7 +20,7 @@ final class WooCommerce {
|
|
20 |
*
|
21 |
* @var string
|
22 |
*/
|
23 |
-
public $version = '3.6.
|
24 |
|
25 |
/**
|
26 |
* The single instance of the class.
|
@@ -546,17 +546,7 @@ final class WooCommerce {
|
|
546 |
|
547 |
// Classes/actions loaded for the frontend and for ajax requests.
|
548 |
if ( $this->is_request( 'frontend' ) ) {
|
549 |
-
|
550 |
-
$session_class = apply_filters( 'woocommerce_session_handler', 'WC_Session_Handler' );
|
551 |
-
$this->session = new $session_class();
|
552 |
-
$this->session->init();
|
553 |
-
|
554 |
-
$this->customer = new WC_Customer( get_current_user_id(), true );
|
555 |
-
// Cart needs the customer info.
|
556 |
-
$this->cart = new WC_Cart();
|
557 |
-
|
558 |
-
// Customer should be saved during shutdown.
|
559 |
-
add_action( 'shutdown', array( $this->customer, 'save' ), 10 );
|
560 |
}
|
561 |
|
562 |
$this->load_webhooks();
|
@@ -725,6 +715,39 @@ final class WooCommerce {
|
|
725 |
wc_load_webhooks( 'active', $limit );
|
726 |
}
|
727 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
728 |
/**
|
729 |
* Set tablenames inside WPDB object.
|
730 |
*/
|
20 |
*
|
21 |
* @var string
|
22 |
*/
|
23 |
+
public $version = '3.6.4';
|
24 |
|
25 |
/**
|
26 |
* The single instance of the class.
|
546 |
|
547 |
// Classes/actions loaded for the frontend and for ajax requests.
|
548 |
if ( $this->is_request( 'frontend' ) ) {
|
549 |
+
wc_load_cart();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
550 |
}
|
551 |
|
552 |
$this->load_webhooks();
|
715 |
wc_load_webhooks( 'active', $limit );
|
716 |
}
|
717 |
|
718 |
+
/**
|
719 |
+
* Initialize the customer and cart objects and setup customer saving on shutdown.
|
720 |
+
*
|
721 |
+
* @since 3.6.4
|
722 |
+
* @return void
|
723 |
+
*/
|
724 |
+
public function initialize_cart() {
|
725 |
+
// Cart needs customer info.
|
726 |
+
if ( is_null( $this->customer ) || ! $this->customer instanceof WC_Customer ) {
|
727 |
+
$this->customer = new WC_Customer( get_current_user_id(), true );
|
728 |
+
// Customer should be saved during shutdown.
|
729 |
+
add_action( 'shutdown', array( $this->customer, 'save' ), 10 );
|
730 |
+
}
|
731 |
+
if ( is_null( $this->cart ) || ! $this->cart instanceof WC_Cart ) {
|
732 |
+
$this->cart = new WC_Cart();
|
733 |
+
}
|
734 |
+
}
|
735 |
+
|
736 |
+
/**
|
737 |
+
* Initialize the session class.
|
738 |
+
*
|
739 |
+
* @since 3.6.4
|
740 |
+
* @return void
|
741 |
+
*/
|
742 |
+
public function initialize_session() {
|
743 |
+
// Session class, handles session data for users - can be overwritten if custom handler is needed.
|
744 |
+
$session_class = apply_filters( 'woocommerce_session_handler', 'WC_Session_Handler' );
|
745 |
+
if ( is_null( $this->session ) || ! $this->session instanceof $session_class ) {
|
746 |
+
$this->session = new $session_class();
|
747 |
+
$this->session->init();
|
748 |
+
}
|
749 |
+
}
|
750 |
+
|
751 |
/**
|
752 |
* Set tablenames inside WPDB object.
|
753 |
*/
|
includes/data-stores/class-wc-coupon-data-store-cpt.php
CHANGED
@@ -368,6 +368,19 @@ class WC_Coupon_Data_Store_CPT extends WC_Data_Store_WP implements WC_Coupon_Dat
|
|
368 |
return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT( meta_id ) FROM {$wpdb->postmeta} WHERE post_id = %d AND meta_key = '_used_by' AND meta_value = %d;", $coupon->get_id(), $user_id ) );
|
369 |
}
|
370 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
371 |
/**
|
372 |
* Return a coupon code for a specific ID.
|
373 |
*
|
368 |
return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT( meta_id ) FROM {$wpdb->postmeta} WHERE post_id = %d AND meta_key = '_used_by' AND meta_value = %d;", $coupon->get_id(), $user_id ) );
|
369 |
}
|
370 |
|
371 |
+
/**
|
372 |
+
* Get the number of uses for a coupon by email address
|
373 |
+
*
|
374 |
+
* @since 3.6.4
|
375 |
+
* @param WC_Coupon $coupon Coupon object.
|
376 |
+
* @param string $email Email address.
|
377 |
+
* @return int
|
378 |
+
*/
|
379 |
+
public function get_usage_by_email( &$coupon, $email ) {
|
380 |
+
global $wpdb;
|
381 |
+
return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT( meta_id ) FROM {$wpdb->postmeta} WHERE post_id = %d AND meta_key = '_used_by' AND meta_value = %s;", $coupon->get_id(), $email ) );
|
382 |
+
}
|
383 |
+
|
384 |
/**
|
385 |
* Return a coupon code for a specific ID.
|
386 |
*
|
includes/shortcodes/class-wc-shortcode-checkout.php
CHANGED
@@ -272,6 +272,7 @@ class WC_Shortcode_Checkout {
|
|
272 |
if ( empty( $_POST ) && wc_notice_count( 'error' ) > 0 ) { // WPCS: input var ok, CSRF ok.
|
273 |
|
274 |
wc_get_template( 'checkout/cart-errors.php', array( 'checkout' => $checkout ) );
|
|
|
275 |
|
276 |
} else {
|
277 |
|
272 |
if ( empty( $_POST ) && wc_notice_count( 'error' ) > 0 ) { // WPCS: input var ok, CSRF ok.
|
273 |
|
274 |
wc_get_template( 'checkout/cart-errors.php', array( 'checkout' => $checkout ) );
|
275 |
+
wc_clear_notices();
|
276 |
|
277 |
} else {
|
278 |
|
includes/tracks/class-wc-site-tracking.php
CHANGED
@@ -18,17 +18,21 @@ class WC_Site_Tracking {
|
|
18 |
*/
|
19 |
public static function is_tracking_enabled() {
|
20 |
/**
|
21 |
-
* Don't track users
|
22 |
-
*
|
|
|
23 |
*/
|
24 |
-
|
25 |
-
if ( ! apply_filters( 'woocommerce_apply_user_tracking', true ) ) {
|
26 |
return false;
|
27 |
}
|
28 |
|
29 |
// Check if tracking is actively being opted into.
|
30 |
$is_obw_opting_in = isset( $_POST['wc_tracker_checkbox'] ) && 'yes' === sanitize_text_field( $_POST['wc_tracker_checkbox'] ); // phpcs:ignore WordPress.Security.NonceVerification.NoNonceVerification, WordPress.Security.ValidatedSanitizedInput
|
31 |
|
|
|
|
|
|
|
|
|
32 |
if ( 'yes' !== get_option( 'woocommerce_allow_tracking' ) && ! $is_obw_opting_in ) {
|
33 |
return false;
|
34 |
}
|
18 |
*/
|
19 |
public static function is_tracking_enabled() {
|
20 |
/**
|
21 |
+
* Don't track users if a filter has been applied to turn it off.
|
22 |
+
* `woocommerce_apply_tracking` will be deprecated. Please use
|
23 |
+
* `woocommerce_apply_user_tracking` instead.
|
24 |
*/
|
25 |
+
if ( ! apply_filters( 'woocommerce_apply_user_tracking', true ) || ! apply_filters( 'woocommerce_apply_tracking', true ) ) {
|
|
|
26 |
return false;
|
27 |
}
|
28 |
|
29 |
// Check if tracking is actively being opted into.
|
30 |
$is_obw_opting_in = isset( $_POST['wc_tracker_checkbox'] ) && 'yes' === sanitize_text_field( $_POST['wc_tracker_checkbox'] ); // phpcs:ignore WordPress.Security.NonceVerification.NoNonceVerification, WordPress.Security.ValidatedSanitizedInput
|
31 |
|
32 |
+
/**
|
33 |
+
* Don't track users who haven't opted-in to tracking or aren't in
|
34 |
+
* the process of opting-in.
|
35 |
+
*/
|
36 |
if ( 'yes' !== get_option( 'woocommerce_allow_tracking' ) && ! $is_obw_opting_in ) {
|
37 |
return false;
|
38 |
}
|
includes/tracks/class-wc-tracks-client.php
CHANGED
@@ -34,7 +34,7 @@ class WC_Tracks_Client {
|
|
34 |
*/
|
35 |
public static function init() {
|
36 |
// Use wp hook for setting the identity cookie to avoid headers already sent warnings.
|
37 |
-
add_action( '
|
38 |
}
|
39 |
|
40 |
/**
|
34 |
*/
|
35 |
public static function init() {
|
36 |
// Use wp hook for setting the identity cookie to avoid headers already sent warnings.
|
37 |
+
add_action( 'admin_init', array( __CLASS__, 'maybe_set_identity_cookie' ) );
|
38 |
}
|
39 |
|
40 |
/**
|
includes/tracks/class-wc-tracks.php
CHANGED
@@ -74,13 +74,9 @@ class WC_Tracks {
|
|
74 |
*/
|
75 |
public static function record_event( $event_name, $properties = array() ) {
|
76 |
/**
|
77 |
-
* Don't track users who
|
78 |
-
* has been applied to turn it off.
|
79 |
*/
|
80 |
-
if (
|
81 |
-
'yes' !== get_option( 'woocommerce_allow_tracking' ) ||
|
82 |
-
! apply_filters( 'woocommerce_apply_tracking', true )
|
83 |
-
) {
|
84 |
return false;
|
85 |
}
|
86 |
|
74 |
*/
|
75 |
public static function record_event( $event_name, $properties = array() ) {
|
76 |
/**
|
77 |
+
* Don't track users who don't have tracking enabled.
|
|
|
78 |
*/
|
79 |
+
if ( ! WC_Site_Tracking::is_tracking_enabled() ) {
|
|
|
|
|
|
|
80 |
return false;
|
81 |
}
|
82 |
|
includes/wc-core-functions.php
CHANGED
@@ -2255,3 +2255,14 @@ function wc_get_server_database_version() {
|
|
2255 |
'number' => preg_replace( '/([^\d.]+).*/', '', $server_info ),
|
2256 |
);
|
2257 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2255 |
'number' => preg_replace( '/([^\d.]+).*/', '', $server_info ),
|
2256 |
);
|
2257 |
}
|
2258 |
+
|
2259 |
+
/**
|
2260 |
+
* Initialize and load the cart functionality.
|
2261 |
+
*
|
2262 |
+
* @since 3.6.4
|
2263 |
+
* @return void
|
2264 |
+
*/
|
2265 |
+
function wc_load_cart() {
|
2266 |
+
WC()->initialize_session();
|
2267 |
+
WC()->initialize_cart();
|
2268 |
+
}
|
includes/wc-order-functions.php
CHANGED
@@ -772,11 +772,13 @@ function wc_order_fully_refunded( $order_id ) {
|
|
772 |
wc_create_refund(
|
773 |
array(
|
774 |
'amount' => $max_refund,
|
775 |
-
'reason' => __( 'Order
|
776 |
'order_id' => $order_id,
|
777 |
'line_items' => array(),
|
778 |
)
|
779 |
);
|
|
|
|
|
780 |
}
|
781 |
add_action( 'woocommerce_order_status_refunded', 'wc_order_fully_refunded' );
|
782 |
|
772 |
wc_create_refund(
|
773 |
array(
|
774 |
'amount' => $max_refund,
|
775 |
+
'reason' => __( 'Order fully refunded.', 'woocommerce' ),
|
776 |
'order_id' => $order_id,
|
777 |
'line_items' => array(),
|
778 |
)
|
779 |
);
|
780 |
+
|
781 |
+
$order->add_order_note( __( 'Order status set to refunded. To return funds to the customer you will need to issue a refund through your payment gateway.', 'woocommerce' ) );
|
782 |
}
|
783 |
add_action( 'woocommerce_order_status_refunded', 'wc_order_fully_refunded' );
|
784 |
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: automattic, mikejolley, jameskoster, claudiosanches, claudiulodro,
|
|
3 |
Tags: ecommerce, e-commerce, store, sales, sell, shop, cart, checkout, downloadable, downloads, payments, paypal, storefront, stripe, woo commerce, woo
|
4 |
Requires at least: 4.7
|
5 |
Tested up to: 5.2
|
6 |
-
Stable tag: 3.6.
|
7 |
License: GPLv3
|
8 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
@@ -188,6 +188,18 @@ INTERESTED IN DEVELOPMENT?
|
|
188 |
|
189 |
== Changelog ==
|
190 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
191 |
= 3.6.3 - 2019-05-16 =
|
192 |
* Fix - State not required for Serbia. #23430
|
193 |
* Fix - # symbol in product category name broke product export. #23454
|
3 |
Tags: ecommerce, e-commerce, store, sales, sell, shop, cart, checkout, downloadable, downloads, payments, paypal, storefront, stripe, woo commerce, woo
|
4 |
Requires at least: 4.7
|
5 |
Tested up to: 5.2
|
6 |
+
Stable tag: 3.6.4
|
7 |
License: GPLv3
|
8 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
188 |
|
189 |
== Changelog ==
|
190 |
|
191 |
+
= 3.6.4 - 2019-05-27 =
|
192 |
+
* Enhancement - Add notice to install WooCommerce Admin. #23659
|
193 |
+
* Fix - Tracks: Add check for OBW is-opting-in. #23772
|
194 |
+
* Fix - Use HTTP protocol for schema.org's availability. #23774
|
195 |
+
* Fix - Coupon usage limit checks based on email never ran when orders are created via wp-admin. #23775
|
196 |
+
* Fix - Duplicate out of stock notices when navigating from cart to checkout and back to cart. #23791
|
197 |
+
* Fix - Remove sensitive information from refund reason when manually refunding an order, and move it to an order note. #23739
|
198 |
+
* Tweak - Tracks: set cookie on admin_init instead of wp_loaded. #23787
|
199 |
+
* Dev - Fixed number of arguments for all occurrences of the woocommerce_valid_order_statuses_for_cancel filter. #23704
|
200 |
+
* Dev - REST API - Stop order creation if invalid data is sent. #23325
|
201 |
+
* Dev - Introduce new wc_load_cart function for dynamically loading and initializing the cart. #23794
|
202 |
+
|
203 |
= 3.6.3 - 2019-05-16 =
|
204 |
* Fix - State not required for Serbia. #23430
|
205 |
* Fix - # symbol in product category name broke product export. #23454
|
woocommerce.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: WooCommerce
|
4 |
* Plugin URI: https://woocommerce.com/
|
5 |
* Description: An eCommerce toolkit that helps you sell anything. Beautifully.
|
6 |
-
* Version: 3.6.
|
7 |
* Author: Automattic
|
8 |
* Author URI: https://woocommerce.com
|
9 |
* Text Domain: woocommerce
|
3 |
* Plugin Name: WooCommerce
|
4 |
* Plugin URI: https://woocommerce.com/
|
5 |
* Description: An eCommerce toolkit that helps you sell anything. Beautifully.
|
6 |
+
* Version: 3.6.4
|
7 |
* Author: Automattic
|
8 |
* Author URI: https://woocommerce.com
|
9 |
* Text Domain: woocommerce
|