Merge branch 'master' into video-updates
This commit is contained in:
commit
05a40d8df7
|
@ -6,7 +6,7 @@ When contributing please ensure you follow the guidelines below to help us keep
|
|||
|
||||
__Please Note:__
|
||||
|
||||
GitHub is for _bug reports and contributions only_ - if you have a support question or a request for a customization this is not the right place to post it. Use [WooThemes Support](https://support.woothemes.com) for customer support, [WordPress.org](https://wordpress.org/support/plugin/woocommerce) for community support, and for customizations we recommend one of the following services:
|
||||
GitHub is for _bug reports and contributions only_ - if you have a support question or a request for a customization this is not the right place to post it. Use [WooCommerce Support](https://support.woocommerce.com) for customer support, [WordPress.org](https://wordpress.org/support/plugin/woocommerce) for community support, and for customizations we recommend one of the following services:
|
||||
|
||||
- [WooExperts](https://woocommerce.com/experts/)
|
||||
- [Codeable](https://codeable.io/)
|
||||
|
@ -96,4 +96,4 @@ By translating video tutorials you'll be helping non-English speaking users and
|
|||
* [GitHub pull request documentation](https://help.github.com/send-pull-requests/)
|
||||
* [Translator Handbook](https://make.wordpress.org/polyglots/handbook/)
|
||||
* [WooCommerce Docs](https://docs.woocommerce.com/)
|
||||
* [WooThemes Support](https://support.woothemes.com)
|
||||
* [WooCommerce Support](https://support.woocommerce.com)
|
||||
|
|
|
@ -1,10 +1,20 @@
|
|||
== Changelog ==
|
||||
|
||||
= 2.6.14 - 2017-02-02 =
|
||||
* Fix - Ensure product exists in wc_update_product_stock.
|
||||
* Fix - Send emails using the site language.
|
||||
* Fix - Remove tilde typo.
|
||||
* Fix - Fixed notice in get_rating_count.
|
||||
* Tweak - Define arg and return data types, added extra descriptions, and correctly cast IDs in the Rest API.
|
||||
* Tweak - Handle custom error data in WC_REST_Exception.
|
||||
* Tweak - Display conflicted product ID when using a duplicate SKU via the API.
|
||||
* Localization - Add Finnish defaults to the installer.
|
||||
|
||||
= 2.6.13 - 2017-01-18 =
|
||||
* Fix - Demo store banner styling in 2017.
|
||||
* Fix - Removed default instructions from COD, BACS and Cheque gateways so displayed messages can be unset.
|
||||
* Fix - Removed default instructions from COD, BACS and Check gateways so displayed messages can be unset.
|
||||
* Fix - Made variation options update on first load.
|
||||
* Localisation - Added Romanian locale to the installer.
|
||||
* Localization - Added Romanian locale to the installer.
|
||||
|
||||
= 2.6.12 - 2017-01-12 =
|
||||
* Fix - Make images shown up on pageload when using ajax variations.
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -281,17 +281,25 @@ a.remove {
|
|||
}
|
||||
}
|
||||
|
||||
dl.variation {
|
||||
dt {
|
||||
dl.variation, .wc-item-meta {
|
||||
list-style: none outside;
|
||||
|
||||
dt, .wc-item-meta-label {
|
||||
float: left;
|
||||
clear: both;
|
||||
margin-right: .25em;
|
||||
display: inline-block;
|
||||
list-style: none outside;
|
||||
}
|
||||
|
||||
dd {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
p,
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1131,30 +1131,24 @@ p.demo_store,
|
|||
}
|
||||
|
||||
td.product-name {
|
||||
dl.variation {
|
||||
margin: 0.25em 0;
|
||||
@include clearfix();
|
||||
dl.variation, .wc-item-meta {
|
||||
list-style: none outside;
|
||||
|
||||
dt,
|
||||
dd {
|
||||
display: inline-block;
|
||||
dt, .wc-item-meta-label {
|
||||
float: left;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
dt {
|
||||
font-weight: 700;
|
||||
padding: 0 0 0.25em;
|
||||
margin: 0 4px 0 0;
|
||||
clear: left;
|
||||
clear: both;
|
||||
margin-right: .25em;
|
||||
display: inline-block;
|
||||
list-style: none outside;
|
||||
}
|
||||
|
||||
dd {
|
||||
padding: 0 0 0.25em;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
p:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
p,
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1407,9 +1401,9 @@ p.demo_store,
|
|||
/**
|
||||
* Order page
|
||||
*/
|
||||
.order_details {
|
||||
ul.order_details {
|
||||
@include clearfix();
|
||||
margin: 0 0 1.5em;
|
||||
margin: 0 0 3em;
|
||||
list-style: none;
|
||||
|
||||
li {
|
||||
|
@ -1437,6 +1431,10 @@ p.demo_store,
|
|||
}
|
||||
}
|
||||
|
||||
.wc-bacs-bank-details-account-name {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/**
|
||||
* Layered nav widget
|
||||
*/
|
||||
|
|
|
@ -1058,39 +1058,27 @@ jQuery( function ( $ ) {
|
|||
},
|
||||
|
||||
add_item: function( add_item_ids ) {
|
||||
add_item_ids = add_item_ids.split( ',' );
|
||||
|
||||
if ( add_item_ids ) {
|
||||
|
||||
var count = add_item_ids.length;
|
||||
|
||||
wc_meta_boxes_order_items.block();
|
||||
|
||||
$.each( add_item_ids, function( index, value ) {
|
||||
var data = {
|
||||
action : 'woocommerce_add_order_item',
|
||||
item_to_add: add_item_ids,
|
||||
dataType : 'json',
|
||||
order_id : woocommerce_admin_meta_boxes.post_id,
|
||||
security : woocommerce_admin_meta_boxes.order_item_nonce
|
||||
};
|
||||
|
||||
var data = {
|
||||
action : 'woocommerce_add_order_item',
|
||||
item_to_add: value,
|
||||
dataType : 'json',
|
||||
order_id : woocommerce_admin_meta_boxes.post_id,
|
||||
security : woocommerce_admin_meta_boxes.order_item_nonce
|
||||
};
|
||||
|
||||
$.post( woocommerce_admin_meta_boxes.ajax_url, data, function( response ) {
|
||||
if ( response.success ) {
|
||||
$( 'table.woocommerce_order_items tbody#order_line_items' ).append( response.data.html );
|
||||
} else {
|
||||
window.alert( response.data.error );
|
||||
}
|
||||
|
||||
if ( !--count ) {
|
||||
wc_meta_boxes_order.init_tiptip();
|
||||
wc_meta_boxes_order_items.unblock();
|
||||
}
|
||||
});
|
||||
$.post( woocommerce_admin_meta_boxes.ajax_url, data, function( response ) {
|
||||
if ( response.success ) {
|
||||
$( 'table.woocommerce_order_items tbody#order_line_items' ).append( response.data.html );
|
||||
} else {
|
||||
window.alert( response.data.error );
|
||||
}
|
||||
|
||||
wc_meta_boxes_order.init_tiptip();
|
||||
wc_meta_boxes_order_items.unblock();
|
||||
});
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -118,21 +118,19 @@ jQuery( function( $ ) {
|
|||
});
|
||||
|
||||
// Datepicker fields
|
||||
$( '.sale_price_dates_fields', wrapper ).each( function() {
|
||||
var dates = $( this ).find( 'input' ).datepicker({
|
||||
defaultDate: '',
|
||||
dateFormat: 'yy-mm-dd',
|
||||
numberOfMonths: 1,
|
||||
showButtonPanel: true,
|
||||
onSelect: function( selectedDate ) {
|
||||
var option = $( this ).is( '.sale_price_dates_from' ) ? 'minDate' : 'maxDate',
|
||||
instance = $( this ).data( 'datepicker' ),
|
||||
date = $.datepicker.parseDate( instance.settings.dateFormat || $.datepicker._defaults.dateFormat, selectedDate, instance.settings );
|
||||
$( '.sale_price_dates_fields', wrapper ).find( 'input' ).datepicker({
|
||||
defaultDate: '',
|
||||
dateFormat: 'yy-mm-dd',
|
||||
numberOfMonths: 1,
|
||||
showButtonPanel: true,
|
||||
onSelect: function( selectedDate, instance ) {
|
||||
var option = $( this ).is( '.sale_price_dates_from' ) ? 'minDate' : 'maxDate',
|
||||
dates = $( this ).closest( '.sale_price_dates_fields' ).find( 'input' ),
|
||||
date = $.datepicker.parseDate( instance.settings.dateFormat || $.datepicker._defaults.dateFormat, selectedDate, instance.settings );
|
||||
|
||||
dates.not( this ).datepicker( 'option', option, date );
|
||||
$( this ).change();
|
||||
}
|
||||
});
|
||||
dates.not( this ).datepicker( 'option', option, date );
|
||||
$( this ).change();
|
||||
}
|
||||
});
|
||||
|
||||
// Allow sorting
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -25,11 +25,14 @@ jQuery( function( $ ) {
|
|||
this.$order_review.on( 'click', 'input[name="payment_method"]', this.payment_method_selected );
|
||||
}
|
||||
|
||||
// Prevent HTML5 validation which can conflict.
|
||||
this.$checkout_form.attr( 'novalidate', 'novalidate' );
|
||||
|
||||
// Form submission
|
||||
this.$checkout_form.on( 'submit', this.submit );
|
||||
|
||||
// Inline validation
|
||||
this.$checkout_form.on( 'blur change', '.input-text, select, input:checkbox', this.validate_field );
|
||||
this.$checkout_form.on( 'input blur change', '.input-text, select, input:checkbox', this.validate_field );
|
||||
|
||||
// Manual trigger
|
||||
this.$checkout_form.on( 'update', this.trigger_update_checkout );
|
||||
|
@ -104,6 +107,8 @@ jQuery( function( $ ) {
|
|||
$( 'div.create-account' ).hide();
|
||||
|
||||
if ( $( this ).is( ':checked' ) ) {
|
||||
// Ensure password is not pre-populated.
|
||||
$( '#account_password' ).val( '' ).change();
|
||||
$( 'div.create-account' ).slideDown();
|
||||
}
|
||||
},
|
||||
|
@ -163,36 +168,45 @@ jQuery( function( $ ) {
|
|||
reset_update_checkout_timer: function() {
|
||||
clearTimeout( wc_checkout_form.updateTimer );
|
||||
},
|
||||
validate_field: function() {
|
||||
var $this = $( this ),
|
||||
$parent = $this.closest( '.form-row' ),
|
||||
validated = true;
|
||||
validate_field: function( e ) {
|
||||
var $this = $( this ),
|
||||
$parent = $this.closest( '.form-row' ),
|
||||
validated = true,
|
||||
validate_required = $parent.is( '.validate-required' ),
|
||||
validate_email = $parent.is( '.validate-email' ),
|
||||
event_type = e.type;
|
||||
|
||||
if ( $parent.is( '.validate-required' ) ) {
|
||||
if ( 'checkbox' === $this.attr( 'type' ) && ! $this.is( ':checked' ) ) {
|
||||
$parent.removeClass( 'woocommerce-validated' ).addClass( 'woocommerce-invalid woocommerce-invalid-required-field' );
|
||||
validated = false;
|
||||
} else if ( $this.val() === '' ) {
|
||||
$parent.removeClass( 'woocommerce-validated' ).addClass( 'woocommerce-invalid woocommerce-invalid-required-field' );
|
||||
validated = false;
|
||||
}
|
||||
if ( 'input' === event_type ) {
|
||||
$parent.removeClass( 'woocommerce-invalid woocommerce-invalid-required-field woocommerce-invalid-email woocommerce-validated' );
|
||||
}
|
||||
|
||||
if ( $parent.is( '.validate-email' ) ) {
|
||||
if ( $this.val() ) {
|
||||
if ( 'focusout' === event_type || 'change' === event_type ) {
|
||||
|
||||
/* https://stackoverflow.com/questions/2855865/jquery-validate-e-mail-address-regex */
|
||||
var pattern = new RegExp(/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i);
|
||||
|
||||
if ( ! pattern.test( $this.val() ) ) {
|
||||
$parent.removeClass( 'woocommerce-validated' ).addClass( 'woocommerce-invalid woocommerce-invalid-email' );
|
||||
if ( validate_required ) {
|
||||
if ( 'checkbox' === $this.attr( 'type' ) && ! $this.is( ':checked' ) ) {
|
||||
$parent.removeClass( 'woocommerce-validated' ).addClass( 'woocommerce-invalid woocommerce-invalid-required-field' );
|
||||
validated = false;
|
||||
} else if ( $this.val() === '' ) {
|
||||
$parent.removeClass( 'woocommerce-validated' ).addClass( 'woocommerce-invalid woocommerce-invalid-required-field' );
|
||||
validated = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( validated ) {
|
||||
$parent.removeClass( 'woocommerce-invalid woocommerce-invalid-required-field' ).addClass( 'woocommerce-validated' );
|
||||
if ( validate_email ) {
|
||||
if ( $this.val() ) {
|
||||
/* https://stackoverflow.com/questions/2855865/jquery-validate-e-mail-address-regex */
|
||||
var pattern = new RegExp(/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i);
|
||||
|
||||
if ( ! pattern.test( $this.val() ) ) {
|
||||
$parent.removeClass( 'woocommerce-validated' ).addClass( 'woocommerce-invalid woocommerce-invalid-email' );
|
||||
validated = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( validated ) {
|
||||
$parent.removeClass( 'woocommerce-invalid woocommerce-invalid-required-field woocommerce-invalid-email' ).addClass( 'woocommerce-validated' );
|
||||
}
|
||||
}
|
||||
},
|
||||
update_checkout: function( event, args ) {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -46,9 +46,8 @@ jQuery( function( $ ) {
|
|||
return wc_country_select_params.i18n_searching;
|
||||
}
|
||||
};
|
||||
|
||||
var language = { 'language' : formatString };
|
||||
|
||||
|
||||
var language = { 'language' : formatString };
|
||||
return language;
|
||||
}
|
||||
|
||||
|
@ -62,6 +61,10 @@ jQuery( function( $ ) {
|
|||
}, getEnhancedSelectFormatString() );
|
||||
|
||||
$( this ).select2( select2_args );
|
||||
// Maintain focus after select https://github.com/select2/select2/issues/4384
|
||||
$( this ).on( 'select2:select', function() {
|
||||
$( this ).focus();
|
||||
} );
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
jQuery(function(a){function b(){var a={noResults:function(){return wc_country_select_params.i18n_no_matches},errorLoading:function(){return wc_country_select_params.i18n_ajax_error},inputTooShort:function(a){var b=a.minimum-a.input.length;return 1===b?wc_country_select_params.i18n_input_too_short_1:wc_country_select_params.i18n_input_too_short_n.replace("%qty%",b)},inputTooLong:function(a){var b=a.input.length-a.maximum;return 1===b?wc_country_select_params.i18n_input_too_long_1:wc_country_select_params.i18n_input_too_long_n.replace("%qty%",b)},maximumSelected:function(a){return 1===a.maximum?wc_country_select_params.i18n_selection_too_long_1:wc_country_select_params.i18n_selection_too_long_n.replace("%qty%",a.maximum)},loadingMore:function(){return wc_country_select_params.i18n_load_more},searching:function(){return wc_country_select_params.i18n_searching}},b={language:a};return b}if("undefined"==typeof wc_country_select_params)return!1;if(a().select2){var c=function(){a("select.country_select:visible, select.state_select:visible").each(function(){var c=a.extend({placeholderOption:"first",width:"100%"},b());a(this).select2(c)})};c(),a(document.body).bind("country_to_state_changed",function(){c()})}var d=wc_country_select_params.countries.replace(/"/g,'"'),e=a.parseJSON(d);a(document.body).on("change","select.country_to_state, input.country_to_state",function(){var b=a(this).closest(".woocommerce-billing-fields, .woocommerce-shipping-fields, .woocommerce-shipping-calculator");b.length||(b=a(this).closest(".form-row").parent());var c=a(this).val(),d=b.find("#billing_state, #shipping_state, #calc_shipping_state"),f=d.parent(),g=d.attr("name"),h=d.attr("id"),i=d.val(),j=d.attr("placeholder")||d.attr("data-placeholder")||"";if(e[c])if(a.isEmptyObject(e[c]))d.parent().hide().find(".select2-container").remove(),d.replaceWith('<input type="hidden" class="hidden" name="'+g+'" id="'+h+'" value="" placeholder="'+j+'" />'),a(document.body).trigger("country_to_state_changed",[c,b]);else{var k="",l=e[c];for(var m in l)l.hasOwnProperty(m)&&(k=k+'<option value="'+m+'">'+l[m]+"</option>");d.parent().show(),d.is("input")&&(d.replaceWith('<select name="'+g+'" id="'+h+'" class="state_select" data-placeholder="'+j+'"></select>'),d=b.find("#billing_state, #shipping_state, #calc_shipping_state")),d.html('<option value="">'+wc_country_select_params.i18n_select_state_text+"</option>"+k),d.val(i).change(),a(document.body).trigger("country_to_state_changed",[c,b])}else d.is("select")?(f.show().find(".select2-container").remove(),d.replaceWith('<input type="text" class="input-text" name="'+g+'" id="'+h+'" placeholder="'+j+'" />'),a(document.body).trigger("country_to_state_changed",[c,b])):d.is('input[type="hidden"]')&&(f.show().find(".select2-container").remove(),d.replaceWith('<input type="text" class="input-text" name="'+g+'" id="'+h+'" placeholder="'+j+'" />'),a(document.body).trigger("country_to_state_changed",[c,b]));a(document.body).trigger("country_to_state_changing",[c,b])}),a(function(){a(":input.country_to_state").change()})});
|
||||
jQuery(function(a){function b(){var a={noResults:function(){return wc_country_select_params.i18n_no_matches},errorLoading:function(){return wc_country_select_params.i18n_ajax_error},inputTooShort:function(a){var b=a.minimum-a.input.length;return 1===b?wc_country_select_params.i18n_input_too_short_1:wc_country_select_params.i18n_input_too_short_n.replace("%qty%",b)},inputTooLong:function(a){var b=a.input.length-a.maximum;return 1===b?wc_country_select_params.i18n_input_too_long_1:wc_country_select_params.i18n_input_too_long_n.replace("%qty%",b)},maximumSelected:function(a){return 1===a.maximum?wc_country_select_params.i18n_selection_too_long_1:wc_country_select_params.i18n_selection_too_long_n.replace("%qty%",a.maximum)},loadingMore:function(){return wc_country_select_params.i18n_load_more},searching:function(){return wc_country_select_params.i18n_searching}},b={language:a};return b}if("undefined"==typeof wc_country_select_params)return!1;if(a().select2){var c=function(){a("select.country_select:visible, select.state_select:visible").each(function(){var c=a.extend({placeholderOption:"first",width:"100%"},b());a(this).select2(c),a(this).on("select2:select",function(){a(this).focus()})})};c(),a(document.body).bind("country_to_state_changed",function(){c()})}var d=wc_country_select_params.countries.replace(/"/g,'"'),e=a.parseJSON(d);a(document.body).on("change","select.country_to_state, input.country_to_state",function(){var b=a(this).closest(".woocommerce-billing-fields, .woocommerce-shipping-fields, .woocommerce-shipping-calculator");b.length||(b=a(this).closest(".form-row").parent());var c=a(this).val(),d=b.find("#billing_state, #shipping_state, #calc_shipping_state"),f=d.parent(),g=d.attr("name"),h=d.attr("id"),i=d.val(),j=d.attr("placeholder")||d.attr("data-placeholder")||"";if(e[c])if(a.isEmptyObject(e[c]))d.parent().hide().find(".select2-container").remove(),d.replaceWith('<input type="hidden" class="hidden" name="'+g+'" id="'+h+'" value="" placeholder="'+j+'" />'),a(document.body).trigger("country_to_state_changed",[c,b]);else{var k="",l=e[c];for(var m in l)l.hasOwnProperty(m)&&(k=k+'<option value="'+m+'">'+l[m]+"</option>");d.parent().show(),d.is("input")&&(d.replaceWith('<select name="'+g+'" id="'+h+'" class="state_select" data-placeholder="'+j+'"></select>'),d=b.find("#billing_state, #shipping_state, #calc_shipping_state")),d.html('<option value="">'+wc_country_select_params.i18n_select_state_text+"</option>"+k),d.val(i).change(),a(document.body).trigger("country_to_state_changed",[c,b])}else d.is("select")?(f.show().find(".select2-container").remove(),d.replaceWith('<input type="text" class="input-text" name="'+g+'" id="'+h+'" placeholder="'+j+'" />'),a(document.body).trigger("country_to_state_changed",[c,b])):d.is('input[type="hidden"]')&&(f.show().find(".select2-container").remove(),d.replaceWith('<input type="text" class="input-text" name="'+g+'" id="'+h+'" placeholder="'+j+'" />'),a(document.body).trigger("country_to_state_changed",[c,b]));a(document.body).trigger("country_to_state_changing",[c,b])}),a(function(){a(":input.country_to_state").change()})});
|
|
@ -19,16 +19,17 @@ jQuery( function( $ ) {
|
|||
* Strength Meter.
|
||||
*/
|
||||
strengthMeter: function() {
|
||||
var wrapper = $( 'form.register, form.checkout, form.edit-account, form.lost_reset_password' ),
|
||||
submit = $( 'input[type="submit"]', wrapper ),
|
||||
field = $( '#reg_password, #account_password, #password_1', wrapper ),
|
||||
strength = 1;
|
||||
var wrapper = $( 'form.register, form.checkout, form.edit-account, form.lost_reset_password' ),
|
||||
submit = $( 'input[type="submit"]', wrapper ),
|
||||
field = $( '#reg_password, #account_password, #password_1', wrapper ),
|
||||
strength = 1,
|
||||
fieldValue = field.val();
|
||||
|
||||
wc_password_strength_meter.includeMeter( wrapper, field );
|
||||
|
||||
strength = wc_password_strength_meter.checkPasswordStrength( wrapper, field );
|
||||
|
||||
if ( strength < wc_password_strength_meter_params.min_password_strength && ! wrapper.is( 'form.checkout' ) ) {
|
||||
if ( fieldValue.length > 0 && strength < wc_password_strength_meter_params.min_password_strength && ! wrapper.is( 'form.checkout' ) ) {
|
||||
submit.attr( 'disabled', 'disabled' ).addClass( 'disabled' );
|
||||
} else {
|
||||
submit.removeAttr( 'disabled', 'disabled' ).removeClass( 'disabled' );
|
||||
|
|
|
@ -1 +1 @@
|
|||
jQuery(function(a){var b={init:function(){a(document.body).on("keyup change","form.register #reg_password, form.checkout #account_password, form.edit-account #password_1, form.lost_reset_password #password_1",this.strengthMeter),a("form.checkout #createaccount").change()},strengthMeter:function(){var c=a("form.register, form.checkout, form.edit-account, form.lost_reset_password"),d=a('input[type="submit"]',c),e=a("#reg_password, #account_password, #password_1",c),f=1;b.includeMeter(c,e),f=b.checkPasswordStrength(c,e),f<wc_password_strength_meter_params.min_password_strength&&!c.is("form.checkout")?d.attr("disabled","disabled").addClass("disabled"):d.removeAttr("disabled","disabled").removeClass("disabled")},includeMeter:function(b,c){var d=b.find(".woocommerce-password-strength");""===c.val()?(d.remove(),a(document.body).trigger("wc-password-strength-removed")):0===d.length&&(c.after('<div class="woocommerce-password-strength" aria-live="polite"></div>'),a(document.body).trigger("wc-password-strength-added"))},checkPasswordStrength:function(a,b){var c=a.find(".woocommerce-password-strength"),d=a.find(".woocommerce-password-hint"),e='<small class="woocommerce-password-hint">'+wc_password_strength_meter_params.i18n_password_hint+"</small>",f=wp.passwordStrength.meter(b.val(),wp.passwordStrength.userInputBlacklist()),g="";switch(c.removeClass("short bad good strong"),d.remove(),f<wc_password_strength_meter_params.min_password_strength&&(g=" - "+wc_password_strength_meter_params.i18n_password_error),f){case 0:c.addClass("short").html(pwsL10n.short+g),c.after(e);break;case 1:c.addClass("bad").html(pwsL10n.bad+g),c.after(e);break;case 2:c.addClass("bad").html(pwsL10n.bad+g),c.after(e);break;case 3:c.addClass("good").html(pwsL10n.good+g);break;case 4:c.addClass("strong").html(pwsL10n.strong+g);break;case 5:c.addClass("short").html(pwsL10n.mismatch)}return f}};b.init()});
|
||||
jQuery(function(a){var b={init:function(){a(document.body).on("keyup change","form.register #reg_password, form.checkout #account_password, form.edit-account #password_1, form.lost_reset_password #password_1",this.strengthMeter),a("form.checkout #createaccount").change()},strengthMeter:function(){var c=a("form.register, form.checkout, form.edit-account, form.lost_reset_password"),d=a('input[type="submit"]',c),e=a("#reg_password, #account_password, #password_1",c),f=1,g=e.val();b.includeMeter(c,e),f=b.checkPasswordStrength(c,e),g.length>0&&f<wc_password_strength_meter_params.min_password_strength&&!c.is("form.checkout")?d.attr("disabled","disabled").addClass("disabled"):d.removeAttr("disabled","disabled").removeClass("disabled")},includeMeter:function(b,c){var d=b.find(".woocommerce-password-strength");""===c.val()?(d.remove(),a(document.body).trigger("wc-password-strength-removed")):0===d.length&&(c.after('<div class="woocommerce-password-strength" aria-live="polite"></div>'),a(document.body).trigger("wc-password-strength-added"))},checkPasswordStrength:function(a,b){var c=a.find(".woocommerce-password-strength"),d=a.find(".woocommerce-password-hint"),e='<small class="woocommerce-password-hint">'+wc_password_strength_meter_params.i18n_password_hint+"</small>",f=wp.passwordStrength.meter(b.val(),wp.passwordStrength.userInputBlacklist()),g="";switch(c.removeClass("short bad good strong"),d.remove(),f<wc_password_strength_meter_params.min_password_strength&&(g=" - "+wc_password_strength_meter_params.i18n_password_error),f){case 0:c.addClass("short").html(pwsL10n.short+g),c.after(e);break;case 1:c.addClass("bad").html(pwsL10n.bad+g),c.after(e);break;case 2:c.addClass("bad").html(pwsL10n.bad+g),c.after(e);break;case 3:c.addClass("good").html(pwsL10n.good+g);break;case 4:c.addClass("strong").html(pwsL10n.strong+g);break;case 5:c.addClass("short").html(pwsL10n.mismatch)}return f}};b.init()});
|
|
@ -131,16 +131,24 @@ jQuery( function( $ ) {
|
|||
* Init zoom.
|
||||
*/
|
||||
init_zoom: function() {
|
||||
var zoom_target = $( '.woocommerce-product-gallery__image' );
|
||||
var zoom_target = $( '.woocommerce-product-gallery__image' ),
|
||||
enable_zoom = false;
|
||||
|
||||
if ( ! wc_single_product_params.flexslider_enabled ) {
|
||||
zoom_target = zoom_target.first();
|
||||
}
|
||||
|
||||
var image_to_zoom = zoom_target.find( 'img' );
|
||||
$( zoom_target ).each( function( index, target ) {
|
||||
var image = $( target ).find( 'img' );
|
||||
|
||||
if ( image.attr( 'width' ) > $( '.woocommerce-product-gallery' ).width() ) {
|
||||
enable_zoom = true;
|
||||
return false;
|
||||
}
|
||||
} );
|
||||
|
||||
// But only zoom if the img is larger than its container.
|
||||
if ( image_to_zoom.attr( 'width' ) > $( '.woocommerce-product-gallery' ).width() ) {
|
||||
if ( enable_zoom ) {
|
||||
zoom_target.trigger( 'zoom.destroy' );
|
||||
zoom_target.zoom({
|
||||
touch: false
|
||||
|
|
|
@ -1 +1 @@
|
|||
jQuery(function(a){if("undefined"==typeof wc_single_product_params)return!1;a("body").on("init",".wc-tabs-wrapper, .woocommerce-tabs",function(){a(".wc-tab, .woocommerce-tabs .panel:not(.panel .panel)").hide();var b=window.location.hash,c=window.location.href,d=a(this).find(".wc-tabs, ul.tabs").first();b.toLowerCase().indexOf("comment-")>=0||"#reviews"===b||"#tab-reviews"===b?d.find("li.reviews_tab a").click():c.indexOf("comment-page-")>0||c.indexOf("cpage=")>0?d.find("li.reviews_tab a").click():d.find("li:first a").click()}).on("click",".wc-tabs li a, ul.tabs li a",function(b){b.preventDefault();var c=a(this),d=c.closest(".wc-tabs-wrapper, .woocommerce-tabs"),e=d.find(".wc-tabs, ul.tabs");e.find("li").removeClass("active"),d.find(".wc-tab, .panel:not(.panel .panel)").hide(),c.closest("li").addClass("active"),d.find(c.attr("href")).show()}).on("click","a.woocommerce-review-link",function(){return a(".reviews_tab a").click(),!0}).on("init","#rating",function(){a("#rating").hide().before('<p class="stars"><span><a class="star-1" href="#">1</a><a class="star-2" href="#">2</a><a class="star-3" href="#">3</a><a class="star-4" href="#">4</a><a class="star-5" href="#">5</a></span></p>')}).on("click","#respond p.stars a",function(){var b=a(this),c=a(this).closest("#respond").find("#rating"),d=a(this).closest(".stars");return c.val(b.text()),b.siblings("a").removeClass("active"),b.addClass("active"),d.addClass("selected"),!1}).on("click","#respond #submit",function(){var b=a(this).closest("#respond").find("#rating"),c=b.val();if(b.length>0&&!c&&"yes"===wc_single_product_params.review_rating_required)return window.alert(wc_single_product_params.i18n_required_rating_text),!1}).on("woocommerce_init_gallery",function(){a.isFunction(a.fn.zoom)&&wc_single_product_params.zoom_enabled&&b.init_zoom()}),a(".wc-tabs-wrapper, .woocommerce-tabs, #rating").trigger("init");var b={init:function(){a.isFunction(a.fn.flexslider)&&wc_single_product_params.flexslider_enabled&&this.init_flexslider(),a.isFunction(a.fn.zoom)&&wc_single_product_params.zoom_enabled&&this.init_zoom(),"undefined"!=typeof PhotoSwipe&&wc_single_product_params.photoswipe_enabled&&this.init_photoswipe()},init_flexslider:function(){a(".woocommerce-product-gallery").flexslider({selector:".woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image",animation:wc_single_product_params.flexslider.animation,smoothHeight:wc_single_product_params.flexslider.smoothHeight,directionNav:wc_single_product_params.flexslider.directionNav,controlNav:wc_single_product_params.flexslider.controlNav,slideshow:wc_single_product_params.flexslider.slideshow,animationSpeed:wc_single_product_params.flexslider.animationSpeed,animationLoop:wc_single_product_params.flexslider.animationLoop,start:function(){var b=a(".woocommerce-product-gallery__image"),c=0;b.each(function(){var b=a(this).height();b>c&&(c=b)}),b.each(function(){a(this).css("min-height",c)})}})},init_zoom:function(){var b=a(".woocommerce-product-gallery__image");wc_single_product_params.flexslider_enabled||(b=b.first());var c=b.find("img");c.attr("width")>a(".woocommerce-product-gallery").width()&&(b.trigger("zoom.destroy"),b.zoom({touch:!1}))},get_gallery_items:function(){var b=a(".woocommerce-product-gallery__wrapper").children(),c=[],d=b.filter(".flex-active-slide").index();return b.length>0&&b.each(function(b,d){var e=a(d).find("img"),f=e.attr("data-large-image"),g=e.attr("data-large-image-width"),h=e.attr("data-large-image-height"),i={src:f,w:g,h:h,title:e.attr("title")};c.push(i)}),{index:d,items:c}},init_photoswipe:function(){wc_single_product_params.zoom_enabled&&(a(".woocommerce-product-gallery--with-images").prepend('<a href="#" class="woocommerce-product-gallery__trigger">🔍</a>'),a(document).on("click",".woocommerce-product-gallery__trigger",this.trigger_photoswipe)),a(document).on("click",".woocommerce-product-gallery__image a",this.trigger_photoswipe)},trigger_photoswipe:function(c){c.preventDefault();var d,e=a(".pswp")[0],f=b.get_gallery_items(),g=a(c.target);d=g.is(".woocommerce-product-gallery__trigger")?g.parents(".woocommerce-product-gallery").find(".flex-active-slide"):c.target.closest("figure");var h={index:a(d).index(),shareEl:!1,closeOnScroll:!1,history:!1,hideAnimationDuration:0,showAnimationDuration:0},i=new PhotoSwipe(e,PhotoSwipeUI_Default,f.items,h);i.init()}};b.init()});
|
||||
jQuery(function(a){if("undefined"==typeof wc_single_product_params)return!1;a("body").on("init",".wc-tabs-wrapper, .woocommerce-tabs",function(){a(".wc-tab, .woocommerce-tabs .panel:not(.panel .panel)").hide();var b=window.location.hash,c=window.location.href,d=a(this).find(".wc-tabs, ul.tabs").first();b.toLowerCase().indexOf("comment-")>=0||"#reviews"===b||"#tab-reviews"===b?d.find("li.reviews_tab a").click():c.indexOf("comment-page-")>0||c.indexOf("cpage=")>0?d.find("li.reviews_tab a").click():d.find("li:first a").click()}).on("click",".wc-tabs li a, ul.tabs li a",function(b){b.preventDefault();var c=a(this),d=c.closest(".wc-tabs-wrapper, .woocommerce-tabs"),e=d.find(".wc-tabs, ul.tabs");e.find("li").removeClass("active"),d.find(".wc-tab, .panel:not(.panel .panel)").hide(),c.closest("li").addClass("active"),d.find(c.attr("href")).show()}).on("click","a.woocommerce-review-link",function(){return a(".reviews_tab a").click(),!0}).on("init","#rating",function(){a("#rating").hide().before('<p class="stars"><span><a class="star-1" href="#">1</a><a class="star-2" href="#">2</a><a class="star-3" href="#">3</a><a class="star-4" href="#">4</a><a class="star-5" href="#">5</a></span></p>')}).on("click","#respond p.stars a",function(){var b=a(this),c=a(this).closest("#respond").find("#rating"),d=a(this).closest(".stars");return c.val(b.text()),b.siblings("a").removeClass("active"),b.addClass("active"),d.addClass("selected"),!1}).on("click","#respond #submit",function(){var b=a(this).closest("#respond").find("#rating"),c=b.val();if(b.length>0&&!c&&"yes"===wc_single_product_params.review_rating_required)return window.alert(wc_single_product_params.i18n_required_rating_text),!1}).on("woocommerce_init_gallery",function(){a.isFunction(a.fn.zoom)&&wc_single_product_params.zoom_enabled&&b.init_zoom()}),a(".wc-tabs-wrapper, .woocommerce-tabs, #rating").trigger("init");var b={init:function(){a.isFunction(a.fn.flexslider)&&wc_single_product_params.flexslider_enabled&&this.init_flexslider(),a.isFunction(a.fn.zoom)&&wc_single_product_params.zoom_enabled&&this.init_zoom(),"undefined"!=typeof PhotoSwipe&&wc_single_product_params.photoswipe_enabled&&this.init_photoswipe()},init_flexslider:function(){a(".woocommerce-product-gallery").flexslider({selector:".woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image",animation:wc_single_product_params.flexslider.animation,smoothHeight:wc_single_product_params.flexslider.smoothHeight,directionNav:wc_single_product_params.flexslider.directionNav,controlNav:wc_single_product_params.flexslider.controlNav,slideshow:wc_single_product_params.flexslider.slideshow,animationSpeed:wc_single_product_params.flexslider.animationSpeed,animationLoop:wc_single_product_params.flexslider.animationLoop,start:function(){var b=a(".woocommerce-product-gallery__image"),c=0;b.each(function(){var b=a(this).height();b>c&&(c=b)}),b.each(function(){a(this).css("min-height",c)})}})},init_zoom:function(){var b=a(".woocommerce-product-gallery__image"),c=!1;wc_single_product_params.flexslider_enabled||(b=b.first()),a(b).each(function(b,d){var e=a(d).find("img");if(e.attr("width")>a(".woocommerce-product-gallery").width())return c=!0,!1}),c&&(b.trigger("zoom.destroy"),b.zoom({touch:!1}))},get_gallery_items:function(){var b=a(".woocommerce-product-gallery__wrapper").children(),c=[],d=b.filter(".flex-active-slide").index();return b.length>0&&b.each(function(b,d){var e=a(d).find("img"),f=e.attr("data-large-image"),g=e.attr("data-large-image-width"),h=e.attr("data-large-image-height"),i={src:f,w:g,h:h,title:e.attr("title")};c.push(i)}),{index:d,items:c}},init_photoswipe:function(){wc_single_product_params.zoom_enabled&&(a(".woocommerce-product-gallery--with-images").prepend('<a href="#" class="woocommerce-product-gallery__trigger">🔍</a>'),a(document).on("click",".woocommerce-product-gallery__trigger",this.trigger_photoswipe)),a(document).on("click",".woocommerce-product-gallery__image a",this.trigger_photoswipe)},trigger_photoswipe:function(c){c.preventDefault();var d,e=a(".pswp")[0],f=b.get_gallery_items(),g=a(c.target);d=g.is(".woocommerce-product-gallery__trigger")?g.parents(".woocommerce-product-gallery").find(".flex-active-slide"):c.target.closest("figure");var h={index:a(d).index(),shareEl:!1,closeOnScroll:!1,history:!1,hideAnimationDuration:0,showAnimationDuration:0},i=new PhotoSwipe(e,PhotoSwipeUI_Default,f.items,h);i.init()}};b.init()});
|
|
@ -121,7 +121,7 @@ return array(
|
|||
'ID' => __( 'Indonesia', 'woocommerce' ),
|
||||
'IR' => __( 'Iran', 'woocommerce' ),
|
||||
'IQ' => __( 'Iraq', 'woocommerce' ),
|
||||
'IE' => __( 'Republic of Ireland', 'woocommerce' ),
|
||||
'IE' => __( 'Ireland', 'woocommerce' ),
|
||||
'IM' => __( 'Isle of Man', 'woocommerce' ),
|
||||
'IL' => __( 'Israel', 'woocommerce' ),
|
||||
'IT' => __( 'Italy', 'woocommerce' ),
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
/**
|
||||
* Pakistan's states
|
||||
*
|
||||
* @author WooCommerce
|
||||
* @category i18n
|
||||
* @package WooCommerce/i18n
|
||||
* @version 2.7.0
|
||||
*/
|
||||
global $states;
|
||||
|
||||
$states['PK'] = array(
|
||||
'JK' => __( 'Azad Kashmir', 'woocommerce' ),
|
||||
'BA' => __( 'Balochistan', 'woocommerce' ),
|
||||
'TA' => __( 'FATA', 'woocommerce' ),
|
||||
'GB' => __( 'Gilgit Baltistan', 'woocommerce' ),
|
||||
'IS' => __( 'Islamabad Capital Territory', 'woocommerce' ),
|
||||
'KP' => __( 'Khyber Pakhtunkhwa', 'woocommerce' ),
|
||||
'PB' => __( 'Punjab', 'woocommerce' ),
|
||||
'SD' => __( 'Sindh', 'woocommerce' ),
|
||||
);
|
|
@ -470,14 +470,14 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
|||
$new_status = 'wc-' === substr( $new_status, 0, 3 ) ? substr( $new_status, 3 ) : $new_status;
|
||||
|
||||
// Only allow valid new status
|
||||
if ( ! in_array( 'wc-' . $new_status, $this->get_valid_statuses() ) ) {
|
||||
if ( ! in_array( 'wc-' . $new_status, $this->get_valid_statuses() ) && 'trash' !== $new_status ) {
|
||||
$new_status = 'pending';
|
||||
}
|
||||
|
||||
$this->set_prop( 'status', $new_status );
|
||||
|
||||
// If the old status is set but unknown (e.g. draft) assume its pending for action usage.
|
||||
if ( $old_status && ! in_array( 'wc-' . $old_status, $this->get_valid_statuses() ) ) {
|
||||
if ( $old_status && ! in_array( 'wc-' . $old_status, $this->get_valid_statuses() ) && 'trash' !== $old_status ) {
|
||||
$old_status = 'pending';
|
||||
}
|
||||
|
||||
|
@ -1068,6 +1068,8 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
|||
public function update_taxes() {
|
||||
$cart_taxes = array();
|
||||
$shipping_taxes = array();
|
||||
$existing_taxes = $this->get_taxes();
|
||||
$saved_rate_ids = array();
|
||||
|
||||
foreach ( $this->get_items( array( 'line_item', 'fee' ) ) as $item_id => $item ) {
|
||||
$taxes = $item->get_taxes();
|
||||
|
@ -1083,11 +1085,22 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
|||
}
|
||||
}
|
||||
|
||||
// Remove old existing tax rows.
|
||||
$this->remove_order_items( 'tax' );
|
||||
foreach ( $existing_taxes as $tax ) {
|
||||
// Remove taxes which no longer exist for cart/shipping.
|
||||
if ( ( ! array_key_exists( $tax->get_rate_id(), $cart_taxes ) && ! array_key_exists( $tax->get_rate_id(), $shipping_taxes ) ) || in_array( $tax->get_rate_id(), $saved_rate_ids ) ) {
|
||||
$this->remove_item( $tax->get_id() );
|
||||
continue;
|
||||
}
|
||||
$saved_rate_ids[] = $tax->get_rate_id();
|
||||
$tax->set_tax_total( isset( $cart_taxes[ $tax->get_rate_id() ] ) ? $cart_taxes[ $tax->get_rate_id() ] : 0 );
|
||||
$tax->set_shipping_tax_total( ! empty( $shipping_taxes[ $tax->get_rate_id() ] ) ? $shipping_taxes[ $tax->get_rate_id() ] : 0 );
|
||||
$tax->save();
|
||||
}
|
||||
|
||||
// Now merge to keep tax rows.
|
||||
foreach ( array_keys( $cart_taxes + $shipping_taxes ) as $tax_rate_id ) {
|
||||
$new_rate_ids = wp_parse_id_list( array_diff( array_keys( $cart_taxes + $shipping_taxes ), $saved_rate_ids ) );
|
||||
|
||||
// New taxes.
|
||||
foreach ( $new_rate_ids as $tax_rate_id ) {
|
||||
$item = new WC_Order_Item_Tax();
|
||||
$item->set_rate( $tax_rate_id );
|
||||
$item->set_tax_total( isset( $cart_taxes[ $tax_rate_id ] ) ? $cart_taxes[ $tax_rate_id ] : 0 );
|
||||
|
@ -1462,22 +1475,6 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
|||
}
|
||||
}
|
||||
|
||||
if ( $this->get_total() > 0 && $this->get_payment_method_title() ) {
|
||||
$total_rows['payment_method'] = array(
|
||||
'label' => __( 'Payment method:', 'woocommerce' ),
|
||||
'value' => $this->get_payment_method_title(),
|
||||
);
|
||||
}
|
||||
|
||||
if ( $refunds = $this->get_refunds() ) {
|
||||
foreach ( $refunds as $id => $refund ) {
|
||||
$total_rows[ 'refund_' . $id ] = array(
|
||||
'label' => $refund->get_reason() ? $refund->get_reason() : __( 'Refund', 'woocommerce' ) . ':',
|
||||
'value' => wc_price( '-' . $refund->get_amount(), array( 'currency' => $this->get_currency() ) ),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$total_rows['order_total'] = array(
|
||||
'label' => __( 'Total:', 'woocommerce' ),
|
||||
'value' => $this->get_formatted_order_total( $tax_display ),
|
||||
|
|
|
@ -118,8 +118,8 @@ class WC_Admin_Duplicate_Product {
|
|||
$duplicate = clone $product;
|
||||
$duplicate->set_id( 0 );
|
||||
$duplicate->set_total_sales( 0 );
|
||||
if ( '' !== $product->get_sku() ) {
|
||||
$duplicate->set_sku( wc_product_generate_unique_sku( 0, $product->get_sku() ) );
|
||||
if ( '' !== $product->get_sku( 'edit' ) ) {
|
||||
$duplicate->set_sku( wc_product_generate_unique_sku( 0, $product->get_sku( 'edit' ) ) );
|
||||
}
|
||||
$duplicate->set_status( 'draft' );
|
||||
|
||||
|
@ -140,8 +140,8 @@ class WC_Admin_Duplicate_Product {
|
|||
$child_duplicate->set_parent_id( $duplicate->get_id() );
|
||||
$child_duplicate->set_id( 0 );
|
||||
|
||||
if ( '' !== $child->get_sku() ) {
|
||||
$child_duplicate->set_sku( wc_product_generate_unique_sku( 0, $child->get_sku() ) );
|
||||
if ( '' !== $child->get_sku( 'edit' ) ) {
|
||||
$child_duplicate->set_sku( wc_product_generate_unique_sku( 0, $child->get_sku( 'edit' ) ) );
|
||||
}
|
||||
|
||||
foreach ( $meta_to_exclude as $meta_key ) {
|
||||
|
|
|
@ -234,7 +234,7 @@ class WC_Admin_Help {
|
|||
'content' =>
|
||||
'<h2>' . __( 'Help & Support', 'woocommerce' ) . '</h2>' .
|
||||
'<p>' . sprintf(
|
||||
__( 'Should you need help understanding, using, or extending WooCommerce, <a href="%s">splease read our documentation</a>. You will find all kinds of resources including snippets, tutorials and much more.' , 'woocommerce' ),
|
||||
__( 'Should you need help understanding, using, or extending WooCommerce, <a href="%s">please read our documentation</a>. You will find all kinds of resources including snippets, tutorials and much more.' , 'woocommerce' ),
|
||||
'https://docs.woocommerce.com/documentation/plugins/woocommerce/?utm_source=helptab&utm_medium=product&utm_content=docs&utm_campaign=woocommerceplugin'
|
||||
) . '</p>' .
|
||||
'<p>' . sprintf(
|
||||
|
|
|
@ -192,7 +192,7 @@ class WC_Admin_Permalink_Settings {
|
|||
}
|
||||
|
||||
// This is an invalid base structure and breaks pages.
|
||||
if ( '/%product_cat%' === $product_base ) {
|
||||
if ( '/%product_cat%/' === trailingslashit( $product_base ) ) {
|
||||
$product_base = '/' . _x( 'product', 'slug', 'woocommerce' ) . $product_base;
|
||||
}
|
||||
} elseif ( empty( $product_base ) ) {
|
||||
|
|
|
@ -450,28 +450,29 @@ class WC_Admin_Post_Types {
|
|||
* @param string $column
|
||||
*/
|
||||
public function render_shop_coupon_columns( $column ) {
|
||||
global $post;
|
||||
global $post, $the_coupon;
|
||||
|
||||
if ( empty( $the_coupon ) || $the_coupon->get_id() !== $post->ID ) {
|
||||
$the_coupon = new WC_Coupon( $post->ID );
|
||||
}
|
||||
|
||||
switch ( $column ) {
|
||||
case 'coupon_code' :
|
||||
$edit_link = get_edit_post_link( $post->ID );
|
||||
$title = _draft_or_post_title();
|
||||
$title = $the_coupon->get_code();
|
||||
|
||||
echo '<strong><a class="row-title" href="' . esc_url( $edit_link ) . '">' . esc_html( $title ) . '</a>';
|
||||
|
||||
_post_states( $post );
|
||||
|
||||
echo '</strong>';
|
||||
break;
|
||||
case 'type' :
|
||||
echo esc_html( wc_get_coupon_type( get_post_meta( $post->ID, 'discount_type', true ) ) );
|
||||
echo esc_html( wc_get_coupon_type( $the_coupon->get_discount_type() ) );
|
||||
break;
|
||||
case 'amount' :
|
||||
echo esc_html( get_post_meta( $post->ID, 'coupon_amount', true ) );
|
||||
echo esc_html( wc_format_localized_price( $the_coupon->get_amount() ) );
|
||||
break;
|
||||
case 'products' :
|
||||
$product_ids = get_post_meta( $post->ID, 'product_ids', true );
|
||||
$product_ids = $product_ids ? array_map( 'absint', explode( ',', $product_ids ) ) : array();
|
||||
$product_ids = $the_coupon->get_product_ids();
|
||||
|
||||
if ( sizeof( $product_ids ) > 0 ) {
|
||||
echo esc_html( implode( ', ', $product_ids ) );
|
||||
|
@ -480,7 +481,7 @@ class WC_Admin_Post_Types {
|
|||
}
|
||||
break;
|
||||
case 'usage_limit' :
|
||||
$usage_limit = get_post_meta( $post->ID, 'usage_limit', true );
|
||||
$usage_limit = $the_coupon->get_usage_limit();
|
||||
|
||||
if ( $usage_limit ) {
|
||||
echo esc_html( $usage_limit );
|
||||
|
@ -489,28 +490,28 @@ class WC_Admin_Post_Types {
|
|||
}
|
||||
break;
|
||||
case 'usage' :
|
||||
$usage_count = absint( get_post_meta( $post->ID, 'usage_count', true ) );
|
||||
$usage_limit = esc_html( get_post_meta( $post->ID, 'usage_limit', true ) );
|
||||
$usage_url = sprintf( '<a href="%s">%s</a>', admin_url( sprintf( 'edit.php?s=%s&post_status=all&post_type=shop_order', esc_html( $post->post_title ) ) ), $usage_count );
|
||||
$usage_count = $the_coupon->get_usage_count();
|
||||
$usage_limit = $the_coupon->get_usage_limit();
|
||||
$usage_url = sprintf( '<a href="%s">%s</a>', admin_url( sprintf( 'edit.php?s=%s&post_status=all&post_type=shop_order', esc_html( $post->post_title ) ) ), esc_html( $usage_count ) );
|
||||
|
||||
/* translators: 1: count 2: limit */
|
||||
printf(
|
||||
__( '%1$s / %2$s', 'woocommerce' ),
|
||||
$usage_url,
|
||||
$usage_limit ? $usage_limit : '∞'
|
||||
esc_html( $usage_limit ? $usage_limit : '∞' )
|
||||
);
|
||||
break;
|
||||
case 'expiry_date' :
|
||||
$expiry_date = get_post_meta( $post->ID, 'expiry_date', true );
|
||||
$expiry_date = $the_coupon->get_date_expires();
|
||||
|
||||
if ( $expiry_date ) {
|
||||
echo esc_html( date_i18n( 'F j, Y', strtotime( $expiry_date ) ) );
|
||||
echo esc_html( date_i18n( 'F j, Y', $expiry_date ) );
|
||||
} else {
|
||||
echo '–';
|
||||
}
|
||||
break;
|
||||
case 'description' :
|
||||
echo wp_kses_post( $post->post_excerpt );
|
||||
echo wp_kses_post( $the_coupon->get_description() ? $the_coupon->get_description() : '–' );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -939,9 +940,10 @@ class WC_Admin_Post_Types {
|
|||
}
|
||||
|
||||
if ( ! empty( $_REQUEST['_shipping_class'] ) ) {
|
||||
$shipping_class = '_no_shipping_class' == $_REQUEST['_shipping_class'] ? '' : wc_clean( $_REQUEST['_shipping_class'] );
|
||||
$shipping_class_id = $data_store->get_shipping_class_id_by_slug( $shipping_class );
|
||||
if ( $shipping_class_id ) {
|
||||
if ( '_no_shipping_class' === $_REQUEST['_shipping_class'] ) {
|
||||
$product->set_shipping_class_id( 0 );
|
||||
} else {
|
||||
$shipping_class_id = $data_store->get_shipping_class_id_by_slug( wc_clean( $_REQUEST['_shipping_class'] ) );
|
||||
$product->set_shipping_class_id( $shipping_class_id );
|
||||
}
|
||||
}
|
||||
|
@ -1078,9 +1080,10 @@ class WC_Admin_Post_Types {
|
|||
}
|
||||
|
||||
if ( ! empty( $_REQUEST['_shipping_class'] ) ) {
|
||||
$shipping_class = '_no_shipping_class' == $_REQUEST['_shipping_class'] ? '' : wc_clean( $_REQUEST['_shipping_class'] );
|
||||
$shipping_class_id = $data_store->get_shipping_class_id_by_slug( $shipping_class );
|
||||
if ( $shipping_class_id ) {
|
||||
if ( '_no_shipping_class' === $_REQUEST['_shipping_class'] ) {
|
||||
$product->set_shipping_class_id( 0 );
|
||||
} else {
|
||||
$shipping_class_id = $data_store->get_shipping_class_id_by_slug( wc_clean( $_REQUEST['_shipping_class'] ) );
|
||||
$product->set_shipping_class_id( $shipping_class_id );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -217,7 +217,7 @@ class WC_Admin_Setup_Wizard {
|
|||
?>
|
||||
<h1><?php _e( 'Page setup', 'woocommerce' ); ?></h1>
|
||||
<form method="post">
|
||||
<p><?php printf( __( 'Your store needs a few essential %1$spages%2$s. The following will be created automatically (if they do not already exist):', 'woocommerce' ), '<a href="' . esc_url( admin_url( 'edit.php?post_type=page' ) ) . '" target="_blank">', '</a>' ); ?></p>
|
||||
<p><?php printf( __( 'Your store needs a few essential <a href="%s" target="_blank">pages</a>. The following will be created automatically (if they do not already exist):', 'woocommerce' ), esc_url( admin_url( 'edit.php?post_type=page' ) ) ); ?></p>
|
||||
<table class="wc-setup-pages" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -249,7 +249,7 @@ class WC_Admin_Setup_Wizard {
|
|||
</tbody>
|
||||
</table>
|
||||
|
||||
<p><?php printf( __( 'Once created, these pages can be managed from your admin dashboard on the %1$sPages screen%2$s. You can control which pages are shown on your website via %3$sAppearance > Menus%4$s.', 'woocommerce' ), '<a href="' . esc_url( admin_url( 'edit.php?post_type=page' ) ) . '" target="_blank">', '</a>', '<a href="' . esc_url( admin_url( 'nav-menus.php' ) ) . '" target="_blank">', '</a>' ); ?></p>
|
||||
<p><?php printf( __( 'Once created, these pages can be managed from your admin dashboard on the <a href="%1$s" target="_blank">Pages screen</a>. You can control which pages are shown on your website via <a href="%2$s" target="_blank">Appearance > Menus</a>.', 'woocommerce' ), esc_url( admin_url( 'edit.php?post_type=page' ) ), esc_url( admin_url( 'nav-menus.php' ) ) ); ?></p>
|
||||
|
||||
<p class="wc-setup-actions step">
|
||||
<input type="submit" class="button-primary button button-large button-next" value="<?php esc_attr_e( 'Continue', 'woocommerce' ); ?>" name="save_step" />
|
||||
|
@ -311,7 +311,7 @@ class WC_Admin_Setup_Wizard {
|
|||
}
|
||||
?>
|
||||
</select>
|
||||
<span class="description"><?php printf( __( 'If your currency is not listed you can %1$sadd it later%2$s.', 'woocommerce' ), '<a href="https://docs.woocommerce.com/document/add-a-custom-currency-symbol/" target="_blank">', '</a>' ); ?></span>
|
||||
<span class="description"><?php printf( __( 'If your currency is not listed you can <a href="%s" target="_blank">add it later</a>.', 'woocommerce' ), 'https://docs.woocommerce.com/document/add-a-custom-currency-symbol/' ); ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -454,7 +454,7 @@ class WC_Admin_Setup_Wizard {
|
|||
?>
|
||||
<tr class="tax-rates">
|
||||
<td colspan="2">
|
||||
<p><?php printf( __( 'The following tax rates will be imported automatically for you. You can read more about taxes in %1$sour documentation%2$s.', 'woocommerce' ), '<a href="https://docs.woocommerce.com/document/setting-up-taxes-in-woocommerce/" target="_blank">', '</a>' ); ?></p>
|
||||
<p><?php printf( __( 'The following tax rates will be imported automatically for you. You can read more about taxes in <a href="%s" target="_blank">our documentation</a>.', 'woocommerce' ), 'https://docs.woocommerce.com/document/setting-up-taxes-in-woocommerce/' ); ?></p>
|
||||
<div class="importing-tax-rates">
|
||||
<table class="tax-rates">
|
||||
<thead>
|
||||
|
@ -481,7 +481,7 @@ class WC_Admin_Setup_Wizard {
|
|||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<p class="description"><?php printf( __( 'You may need to add/edit rates based on your products or business location which can be done from the %1$stax settings%2$s screen. If in doubt, speak to an accountant.', 'woocommerce' ), '<a href="' . admin_url( 'admin.php?page=wc-settings&tab=tax' ) . '" target="_blank">', '</a>' ); ?></p>
|
||||
<p class="description"><?php printf( __( 'You may need to add/edit rates based on your products or business location which can be done from the <a href="%s" target="_blank">tax settings</a> screen. If in doubt, speak to an accountant.', 'woocommerce' ), esc_url( admin_url( 'admin.php?page=wc-settings&tab=tax' ) ) ); ?></p>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
|
@ -564,21 +564,21 @@ class WC_Admin_Setup_Wizard {
|
|||
'paypal-braintree' => array(
|
||||
'name' => __( 'PayPal by Braintree', 'woocommerce' ),
|
||||
'image' => WC()->plugin_url() . '/assets/images/paypal-braintree.png',
|
||||
'description' => sprintf( __( 'Safe and secure payments using credit cards or your customer\'s PayPal account. %1$sLearn more about PayPal%2$s.', 'woocommerce' ), '<a href="https://wordpress.org/plugins/woocommerce-gateway-paypal-powered-by-braintree/" target="_blank">', '</a>' ),
|
||||
'description' => sprintf( __( 'Safe and secure payments using credit cards or your customer\'s PayPal account. <a href="%s" target="_blank">Learn more about PayPal</a>.', 'woocommerce' ), 'https://wordpress.org/plugins/woocommerce-gateway-paypal-powered-by-braintree/' ),
|
||||
'class' => 'featured featured-row-last',
|
||||
'repo-slug' => 'woocommerce-gateway-paypal-powered-by-braintree',
|
||||
),
|
||||
'paypal-ec' => array(
|
||||
'name' => __( 'PayPal Express Checkout', 'woocommerce' ),
|
||||
'image' => WC()->plugin_url() . '/assets/images/paypal.png',
|
||||
'description' => sprintf( __( 'Safe and secure payments using credit cards or your customer\'s PayPal account. %1$sLearn more about PayPal%2$s.', 'woocommerce' ), '<a href="https://wordpress.org/plugins/woocommerce-gateway-paypal-express-checkout/" target="_blank">', '</a>' ),
|
||||
'description' => sprintf( __( 'Safe and secure payments using credit cards or your customer\'s PayPal account. <a href="%s" target="_blank">Learn more about PayPal</a>.', 'woocommerce' ), 'https://wordpress.org/plugins/woocommerce-gateway-paypal-express-checkout/' ),
|
||||
'class' => 'featured featured-row-last',
|
||||
'repo-slug' => 'woocommerce-gateway-paypal-express-checkout',
|
||||
),
|
||||
'stripe' => array(
|
||||
'name' => __( 'Stripe', 'woocommerce' ),
|
||||
'image' => WC()->plugin_url() . '/assets/images/stripe.png',
|
||||
'description' => sprintf( __( 'A modern and robust way to accept credit card payments on your store. %1$sLearn more about Stripe%2$s.', 'woocommerce' ), '<a href="https://wordpress.org/plugins/woocommerce-gateway-stripe/" target="_blank">', '</a>' ),
|
||||
'description' => sprintf( __( 'A modern and robust way to accept credit card payments on your store. <a href="%s" target="_blank">Learn more about Stripe</a>.', 'woocommerce' ), 'https://wordpress.org/plugins/woocommerce-gateway-stripe/' ),
|
||||
'class' => 'featured featured-row-first',
|
||||
'repo-slug' => 'woocommerce-gateway-stripe',
|
||||
),
|
||||
|
@ -641,7 +641,7 @@ class WC_Admin_Setup_Wizard {
|
|||
?>
|
||||
<h1><?php _e( 'Payments', 'woocommerce' ); ?></h1>
|
||||
<form method="post" class="wc-wizard-payment-gateway-form">
|
||||
<p><?php printf( __( 'WooCommerce can accept both online and offline payments. %2$sAdditional payment methods%3$s can be installed later and managed from the %1$scheckout settings%3$s screen.', 'woocommerce' ), '<a href="' . admin_url( 'admin.php?page=wc-settings&tab=checkout' ) . '" target="_blank">', '<a href="' . admin_url( 'admin.php?page=wc-addons&view=payment-gateways' ) . '" target="_blank">', '</a>' ); ?></p>
|
||||
<p><?php printf( __( 'WooCommerce can accept both online and offline payments. <a href="%1$s" target="_blank">Additional payment methods</a> can be installed later and managed from the <a href="%2$s" target="_blank">checkout settings</a> screen.', 'woocommerce' ), esc_url( admin_url( 'admin.php?page=wc-addons&view=payment-gateways' ) ), esc_url( admin_url( 'admin.php?page=wc-settings&tab=checkout' ) ) ); ?></p>
|
||||
|
||||
<ul class="wc-wizard-payment-gateways">
|
||||
<?php foreach ( $gateways as $gateway_id => $gateway ) : ?>
|
||||
|
|
|
@ -219,7 +219,8 @@ class WC_Admin {
|
|||
if ( isset( $current_screen->id ) && apply_filters( 'woocommerce_display_admin_footer_text', in_array( $current_screen->id, $wc_pages ) ) ) {
|
||||
// Change the footer text
|
||||
if ( ! get_option( 'woocommerce_admin_footer_text_rated' ) ) {
|
||||
$footer_text = sprintf( __( 'If you like <strong>WooCommerce</strong> please leave us a %1$s★★★★★%2$s rating. A huge thanks in advance!', 'woocommerce' ), '<a href="https://wordpress.org/support/plugin/woocommerce/reviews?rate=5#new-post" target="_blank" class="wc-rating-link" data-rated="' . esc_attr__( 'Thanks :)', 'woocommerce' ) . '">', '</a>' );
|
||||
/* translators: %s: five stars */
|
||||
$footer_text = sprintf( __( 'If you like <strong>WooCommerce</strong> please leave us a %s rating. A huge thanks in advance!', 'woocommerce' ), '<a href="https://wordpress.org/support/plugin/woocommerce/reviews?rate=5#new-post" target="_blank" class="wc-rating-link" data-rated="' . esc_attr__( 'Thanks :)', 'woocommerce' ) . '">★★★★★</a>' );
|
||||
wc_enqueue_js( "
|
||||
jQuery( 'a.wc-rating-link' ).click( function() {
|
||||
jQuery.post( '" . WC()->ajax_url() . "', { action: 'woocommerce_rated' } );
|
||||
|
|
|
@ -58,7 +58,7 @@ class WC_Meta_Box_Coupon_Data {
|
|||
|
||||
foreach ( $coupon_data_tabs as $key => $tab ) {
|
||||
?><li class="<?php echo $key; ?>_options <?php echo $key; ?>_tab <?php echo implode( ' ' , (array) $tab['class'] ); ?>">
|
||||
<a href="#<?php echo $tab['target']; ?>"><?php echo esc_html( $tab['label'] ); ?></a>
|
||||
<a href="#<?php echo $tab['target']; ?>"><span><?php echo esc_html( $tab['label'] ); ?></span></a>
|
||||
</li><?php
|
||||
}
|
||||
?>
|
||||
|
@ -66,17 +66,41 @@ class WC_Meta_Box_Coupon_Data {
|
|||
<div id="general_coupon_data" class="panel woocommerce_options_panel"><?php
|
||||
|
||||
// Type
|
||||
woocommerce_wp_select( array( 'id' => 'discount_type', 'label' => __( 'Discount type', 'woocommerce' ), 'options' => wc_get_coupon_types() ) );
|
||||
woocommerce_wp_select( array(
|
||||
'id' => 'discount_type',
|
||||
'label' => __( 'Discount type', 'woocommerce' ),
|
||||
'options' => wc_get_coupon_types()
|
||||
) );
|
||||
|
||||
// Amount
|
||||
woocommerce_wp_text_input( array( 'id' => 'coupon_amount', 'label' => __( 'Coupon amount', 'woocommerce' ), 'placeholder' => wc_format_localized_price( 0 ), 'description' => __( 'Value of the coupon.', 'woocommerce' ), 'data_type' => 'price', 'desc_tip' => true ) );
|
||||
woocommerce_wp_text_input( array(
|
||||
'id' => 'coupon_amount',
|
||||
'label' => __( 'Coupon amount', 'woocommerce' ),
|
||||
'placeholder' => wc_format_localized_price( 0 ),
|
||||
'description' => __( 'Value of the coupon.', 'woocommerce' ),
|
||||
'data_type' => 'price',
|
||||
'desc_tip' => true
|
||||
) );
|
||||
|
||||
// Free Shipping
|
||||
woocommerce_wp_checkbox( array( 'id' => 'free_shipping', 'label' => __( 'Allow free shipping', 'woocommerce' ), 'description' => sprintf( __( 'Check this box if the coupon grants free shipping. A <a href="%s" target="_blank">free shipping method</a> must be enabled in your shipping zone and be set to require "a valid free shipping coupon" (see the "Free Shipping Requires" setting).', 'woocommerce' ), 'https://docs.woocommerce.com/document/free-shipping/' ) ) );
|
||||
if ( wc_shipping_enabled() ) {
|
||||
woocommerce_wp_checkbox( array(
|
||||
'id' => 'free_shipping',
|
||||
'label' => __( 'Allow free shipping', 'woocommerce' ),
|
||||
'description' => sprintf( __( 'Check this box if the coupon grants free shipping. A <a href="%s" target="_blank">free shipping method</a> must be enabled in your shipping zone and be set to require "a valid free shipping coupon" (see the "Free Shipping Requires" setting).', 'woocommerce' ), 'https://docs.woocommerce.com/document/free-shipping/' )
|
||||
) );
|
||||
}
|
||||
|
||||
// Expiry date
|
||||
$expiry_date = $coupon->get_date_expires() ? date( 'Y-m-d', $coupon->get_date_expires() ) : '';
|
||||
woocommerce_wp_text_input( array( 'id' => 'expiry_date', 'value' => esc_attr( $expiry_date ), 'label' => __( 'Coupon expiry date', 'woocommerce' ), 'placeholder' => 'YYYY-MM-DD', 'description' => '', 'class' => 'date-picker', 'custom_attributes' => array( 'pattern' => "[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" ) ) );
|
||||
woocommerce_wp_text_input( array(
|
||||
'id' => 'expiry_date',
|
||||
'value' => esc_attr( $expiry_date ),
|
||||
'label' => __( 'Coupon expiry date', 'woocommerce' ),
|
||||
'placeholder' => 'YYYY-MM-DD', 'description' => '',
|
||||
'class' => 'date-picker',
|
||||
'custom_attributes' => array( 'pattern' => apply_filters( 'woocommerce_date_input_html_pattern', '[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])' ) )
|
||||
) );
|
||||
|
||||
do_action( 'woocommerce_coupon_options', $coupon->get_id(), $coupon );
|
||||
|
||||
|
@ -86,16 +110,36 @@ class WC_Meta_Box_Coupon_Data {
|
|||
echo '<div class="options_group">';
|
||||
|
||||
// minimum spend
|
||||
woocommerce_wp_text_input( array( 'id' => 'minimum_amount', 'label' => __( 'Minimum spend', 'woocommerce' ), 'placeholder' => __( 'No minimum', 'woocommerce' ), 'description' => __( 'This field allows you to set the minimum spend (subtotal, including taxes) allowed to use the coupon.', 'woocommerce' ), 'data_type' => 'price', 'desc_tip' => true ) );
|
||||
woocommerce_wp_text_input( array(
|
||||
'id' => 'minimum_amount',
|
||||
'label' => __( 'Minimum spend', 'woocommerce' ),
|
||||
'placeholder' => __( 'No minimum', 'woocommerce' ),
|
||||
'description' => __( 'This field allows you to set the minimum spend (subtotal, including taxes) allowed to use the coupon.', 'woocommerce' ),
|
||||
'data_type' => 'price', 'desc_tip' => true
|
||||
) );
|
||||
|
||||
// maximum spend
|
||||
woocommerce_wp_text_input( array( 'id' => 'maximum_amount', 'label' => __( 'Maximum spend', 'woocommerce' ), 'placeholder' => __( 'No maximum', 'woocommerce' ), 'description' => __( 'This field allows you to set the maximum spend (subtotal, including taxes) allowed when using the coupon.', 'woocommerce' ), 'data_type' => 'price', 'desc_tip' => true ) );
|
||||
woocommerce_wp_text_input( array(
|
||||
'id' => 'maximum_amount',
|
||||
'label' => __( 'Maximum spend', 'woocommerce' ),
|
||||
'placeholder' => __( 'No maximum', 'woocommerce' ),
|
||||
'description' => __( 'This field allows you to set the maximum spend (subtotal, including taxes) allowed when using the coupon.', 'woocommerce' ),
|
||||
'data_type' => 'price', 'desc_tip' => true
|
||||
) );
|
||||
|
||||
// Individual use
|
||||
woocommerce_wp_checkbox( array( 'id' => 'individual_use', 'label' => __( 'Individual use only', 'woocommerce' ), 'description' => __( 'Check this box if the coupon cannot be used in conjunction with other coupons.', 'woocommerce' ) ) );
|
||||
woocommerce_wp_checkbox( array(
|
||||
'id' => 'individual_use',
|
||||
'label' => __( 'Individual use only', 'woocommerce' ),
|
||||
'description' => __( 'Check this box if the coupon cannot be used in conjunction with other coupons.', 'woocommerce' )
|
||||
) );
|
||||
|
||||
// Exclude Sale Products
|
||||
woocommerce_wp_checkbox( array( 'id' => 'exclude_sale_items', 'label' => __( 'Exclude sale items', 'woocommerce' ), 'description' => __( 'Check this box if the coupon should not apply to items on sale. Per-item coupons will only work if the item is not on sale. Per-cart coupons will only work if there are no sale items in the cart.', 'woocommerce' ) ) );
|
||||
woocommerce_wp_checkbox( array(
|
||||
'id' => 'exclude_sale_items',
|
||||
'label' => __( 'Exclude sale items', 'woocommerce' ),
|
||||
'description' => __( 'Check this box if the coupon should not apply to items on sale. Per-item coupons will only work if the item is not on sale. Per-cart coupons will only work if there are no sale items in the cart.', 'woocommerce' )
|
||||
) );
|
||||
|
||||
echo '</div><div class="options_group">';
|
||||
|
||||
|
@ -260,7 +304,7 @@ class WC_Meta_Box_Coupon_Data {
|
|||
global $wpdb;
|
||||
|
||||
// Check for dupe coupons
|
||||
$coupon_code = apply_filters( 'woocommerce_coupon_code', $post->post_title );
|
||||
$coupon_code = wc_format_coupon_code( $post->post_title );
|
||||
$id_from_code = wc_get_coupon_id_by_code( $coupon_code, $post_id );
|
||||
|
||||
if ( $id_from_code ) {
|
||||
|
|
|
@ -213,7 +213,7 @@ class WC_Meta_Box_Order_Data {
|
|||
<h3><?php _e( 'General Details', 'woocommerce' ); ?></h3>
|
||||
|
||||
<p class="form-field form-field-wide"><label for="order_date"><?php _e( 'Order date:', 'woocommerce' ) ?></label>
|
||||
<input type="text" class="date-picker" name="order_date" id="order_date" maxlength="10" value="<?php echo date_i18n( 'Y-m-d', strtotime( $post->post_date ) ); ?>" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" />@<input type="number" class="hour" placeholder="<?php esc_attr_e( 'h', 'woocommerce' ) ?>" name="order_date_hour" id="order_date_hour" min="0" max="23" step="1" value="<?php echo date_i18n( 'H', strtotime( $post->post_date ) ); ?>" pattern="([01]?[0-9]{1}|2[0-3]{1})" />:<input type="number" class="minute" placeholder="<?php esc_attr_e( 'm', 'woocommerce' ) ?>" name="order_date_minute" id="order_date_minute" min="0" max="59" step="1" value="<?php echo date_i18n( 'i', strtotime( $post->post_date ) ); ?>" pattern="[0-5]{1}[0-9]{1}" />
|
||||
<input type="text" class="date-picker" name="order_date" id="order_date" maxlength="10" value="<?php echo date_i18n( 'Y-m-d', strtotime( $post->post_date ) ); ?>" pattern="<?php echo esc_attr( apply_filters( 'woocommerce_date_input_html_pattern', '[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])' ) ); ?>" />@<input type="number" class="hour" placeholder="<?php esc_attr_e( 'h', 'woocommerce' ) ?>" name="order_date_hour" id="order_date_hour" min="0" max="23" step="1" value="<?php echo date_i18n( 'H', strtotime( $post->post_date ) ); ?>" pattern="([01]?[0-9]{1}|2[0-3]{1})" />:<input type="number" class="minute" placeholder="<?php esc_attr_e( 'm', 'woocommerce' ) ?>" name="order_date_minute" id="order_date_minute" min="0" max="59" step="1" value="<?php echo date_i18n( 'i', strtotime( $post->post_date ) ); ?>" pattern="[0-5]{1}[0-9]{1}" />
|
||||
</p>
|
||||
|
||||
<p class="form-field form-field-wide wc-order-status"><label for="order_status"><?php _e( 'Order status:', 'woocommerce' ) ?> <?php
|
||||
|
|
|
@ -29,7 +29,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
</td>
|
||||
<td>
|
||||
<label><?php _e( 'Access expires', 'woocommerce' ); ?></label>
|
||||
<input type="text" class="short date-picker" name="access_expires[<?php echo $loop; ?>]" value="<?php echo $download->get_access_expires() > 0 ? date_i18n( 'Y-m-d', $download->get_access_expires() ) : ''; ?>" maxlength="10" placeholder="<?php esc_attr_e( 'Never', 'woocommerce' ); ?>" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" />
|
||||
<input type="text" class="short date-picker" name="access_expires[<?php echo $loop; ?>]" value="<?php echo $download->get_access_expires() > 0 ? date_i18n( 'Y-m-d', $download->get_access_expires() ) : ''; ?>" maxlength="10" placeholder="<?php esc_attr_e( 'Never', 'woocommerce' ); ?>" pattern="<?php echo esc_attr( apply_filters( 'woocommerce_date_input_html_pattern', '[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])' ) ); ?>" />
|
||||
</td>
|
||||
<td>
|
||||
<label><?php _e( 'Customer download link', 'woocommerce' ); ?></label>
|
||||
|
|
|
@ -91,11 +91,11 @@ $thumbnail = $product ? apply_filters( 'woocommerce_admin_order_item_thumbnai
|
|||
<div class="split-input">
|
||||
<div class="input">
|
||||
<label><?php esc_attr_e( 'Pre-discount:', 'woocommerce' ); ?></label>
|
||||
<input type="text" name="line_subtotal[<?php echo absint( $item_id ); ?>]" placeholder="<?php echo wc_format_localized_price( 0 ); ?>" value="<?php echo esc_attr( $item->get_subtotal() ); ?>" class="line_subtotal wc_input_price" data-subtotal="<?php echo esc_attr( $item->get_subtotal() ); ?>" />
|
||||
<input type="text" name="line_subtotal[<?php echo absint( $item_id ); ?>]" placeholder="<?php echo wc_format_localized_price( 0 ); ?>" value="<?php echo esc_attr( wc_format_localized_price( $item->get_subtotal() ) ); ?>" class="line_subtotal wc_input_price" data-subtotal="<?php echo esc_attr( wc_format_localized_price( $item->get_subtotal() ) ); ?>" />
|
||||
</div>
|
||||
<div class="input">
|
||||
<label><?php esc_attr_e( 'Total:', 'woocommerce' ); ?></label>
|
||||
<input type="text" name="line_total[<?php echo absint( $item_id ); ?>]" placeholder="<?php echo wc_format_localized_price( 0 ); ?>" value="<?php echo esc_attr( $item->get_total() ); ?>" class="line_total wc_input_price" data-tip="<?php esc_attr_e( 'After pre-tax discounts.', 'woocommerce' ); ?>" data-total="<?php echo esc_attr( $item->get_total() ); ?>" />
|
||||
<input type="text" name="line_total[<?php echo absint( $item_id ); ?>]" placeholder="<?php echo wc_format_localized_price( 0 ); ?>" value="<?php echo esc_attr( wc_format_localized_price( $item->get_total() ) ); ?>" class="line_total wc_input_price" data-tip="<?php esc_attr_e( 'After pre-tax discounts.', 'woocommerce' ); ?>" data-total="<?php echo esc_attr( wc_format_localized_price( $item->get_total() ) ); ?>" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -283,7 +283,7 @@ if ( wc_tax_enabled() ) {
|
|||
</header>
|
||||
<article>
|
||||
<form action="" method="post">
|
||||
<select class="wc-product-search" multiple="multiple" style="width: 50%;" id="add_item_id" name="add_order_items" data-placeholder="<?php esc_attr_e( 'Search for a product…', 'woocommerce' ); ?>"></select>
|
||||
<select class="wc-product-search" multiple="multiple" style="width: 50%;" id="add_item_id" name="add_order_items[]" data-placeholder="<?php esc_attr_e( 'Search for a product…', 'woocommerce' ); ?>"></select>
|
||||
</form>
|
||||
</article>
|
||||
<footer>
|
||||
|
|
|
@ -42,8 +42,8 @@
|
|||
|
||||
echo '<p class="form-field sale_price_dates_fields">
|
||||
<label for="_sale_price_dates_from">' . __( 'Sale price dates', 'woocommerce' ) . '</label>
|
||||
<input type="text" class="short" name="_sale_price_dates_from" id="_sale_price_dates_from" value="' . esc_attr( $sale_price_dates_from ) . '" placeholder="' . _x( 'From…', 'placeholder', 'woocommerce' ) . ' YYYY-MM-DD" maxlength="10" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" />
|
||||
<input type="text" class="short" name="_sale_price_dates_to" id="_sale_price_dates_to" value="' . esc_attr( $sale_price_dates_to ) . '" placeholder="' . _x( 'To…', 'placeholder', 'woocommerce' ) . ' YYYY-MM-DD" maxlength="10" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" />
|
||||
<input type="text" class="short" name="_sale_price_dates_from" id="_sale_price_dates_from" value="' . esc_attr( $sale_price_dates_from ) . '" placeholder="' . _x( 'From…', 'placeholder', 'woocommerce' ) . ' YYYY-MM-DD" maxlength="10" pattern="' . esc_attr( apply_filters( 'woocommerce_date_input_html_pattern', '[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])' ) ) . '" />
|
||||
<input type="text" class="short" name="_sale_price_dates_to" id="_sale_price_dates_to" value="' . esc_attr( $sale_price_dates_to ) . '" placeholder="' . _x( 'To…', 'placeholder', 'woocommerce' ) . ' YYYY-MM-DD" maxlength="10" pattern="' . esc_attr( apply_filters( 'woocommerce_date_input_html_pattern', '[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])' ) ) . '" />
|
||||
<a href="#" class="cancel_sale_schedule">' . __( 'Cancel', 'woocommerce' ) . '</a>' . wc_help_tip( __( 'The sale will end at the beginning of the set date.', 'woocommerce' ) ) . '
|
||||
</p>';
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<tr>
|
||||
<td class="file_name">
|
||||
<input type="text" class="input_text" placeholder="<?php esc_attr_e( 'File name', 'woocommerce' ); ?>" name="_wc_variation_file_names[<?php echo $variation_id; ?>][]" value="<?php echo esc_attr( $file['name'] ); ?>" />
|
||||
<input type="hidden" name="_wc_variation_file_hashes[]" value="<?php echo esc_attr( $key ); ?>" />
|
||||
<input type="hidden" name="_wc_variation_file_hashes[<?php echo $variation_id; ?>][]" value="<?php echo esc_attr( $key ); ?>" />
|
||||
</td>
|
||||
<td class="file_url"><input type="text" class="input_text" placeholder="<?php esc_attr_e( "http://", 'woocommerce' ); ?>" name="_wc_variation_file_urls[<?php echo $variation_id; ?>][]" value="<?php echo esc_attr( $file['file'] ); ?>" /></td>
|
||||
<td class="file_url_choose" width="1%"><a href="#" class="button upload_file_button" data-choose="<?php esc_attr_e( 'Choose file', 'woocommerce' ); ?>" data-update="<?php esc_attr_e( 'Insert file URL', 'woocommerce' ); ?>"><?php echo str_replace( ' ', ' ', __( 'Choose file', 'woocommerce' ) ); ?></a></td>
|
||||
|
|
|
@ -131,11 +131,11 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
echo '<div class="form-field sale_price_dates_fields hidden">
|
||||
<p class="form-row form-row-first">
|
||||
<label>' . __( 'Sale start date', 'woocommerce' ) . '</label>
|
||||
<input type="text" class="sale_price_dates_from" name="variable_sale_price_dates_from[' . $loop . ']" value="' . esc_attr( $sale_price_dates_from ) . '" placeholder="' . _x( 'From…', 'placeholder', 'woocommerce' ) . ' YYYY-MM-DD" maxlength="10" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" />
|
||||
<input type="text" class="sale_price_dates_from" name="variable_sale_price_dates_from[' . $loop . ']" value="' . esc_attr( $sale_price_dates_from ) . '" placeholder="' . _x( 'From…', 'placeholder', 'woocommerce' ) . ' YYYY-MM-DD" maxlength="10" pattern="' . esc_attr( apply_filters( 'woocommerce_date_input_html_pattern', '[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])' ) ) . '" />
|
||||
</p>
|
||||
<p class="form-row form-row-last">
|
||||
<label>' . __( 'Sale end date', 'woocommerce' ) . '</label>
|
||||
<input type="text" class="sale_price_dates_to" name="variable_sale_price_dates_to[' . $loop . ']" id="_sale_price_dates_to" value="' . esc_attr( $sale_price_dates_to ) . '" placeholder="' . _x( 'To…', 'placeholder', 'woocommerce' ) . ' YYYY-MM-DD" maxlength="10" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" />
|
||||
<input type="text" class="sale_price_dates_to" name="variable_sale_price_dates_to[' . $loop . ']" value="' . esc_attr( $sale_price_dates_to ) . '" placeholder="' . _x( 'To…', 'placeholder', 'woocommerce' ) . ' YYYY-MM-DD" maxlength="10" pattern="' . esc_attr( apply_filters( 'woocommerce_date_input_html_pattern', '[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])' ) ) . '" />
|
||||
</p>
|
||||
</div>';
|
||||
|
||||
|
|
|
@ -22,11 +22,11 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
<thead>
|
||||
<tr>
|
||||
<th width="8%"><a href="https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes" target="_blank"><?php _e( 'Country code', 'woocommerce' ); ?></a> <?php echo wc_help_tip( __( 'A 2 digit country code, e.g. US. Leave blank to apply to all.', 'woocommerce' ) ); ?></th>
|
||||
<th width="8%"><?php _e( 'State code', 'woocommerce' ); ?> <?php echo wc_help_tip( __( 'A 2 digit state code, e.g. AL. Leave blank to apply to all.', 'woocommerce' ) ); ?></th>
|
||||
<th width="8%"><?php _e( 'State code', 'woocommerce' ); ?> <?php echo wc_help_tip( __( 'A 2 digit state code, e.g. AL. Leave blank to apply to all.', 'woocommerce' ) ); ?></th>
|
||||
<th><?php _e( 'Postcode / ZIP', 'woocommerce' ); ?> <?php echo wc_help_tip( __( 'Postcode for this rule. Semi-colon (;) separate multiple values. Leave blank to apply to all areas. Wildcards (*) and ranges for numeric postcodes (e.g. 12345...12350) can also be used.', 'woocommerce' ) ); ?></th>
|
||||
<th><?php _e( 'City', 'woocommerce' ); ?> <?php echo wc_help_tip( __( 'Cities for this rule. Semi-colon (;) separate multiple values. Leave blank to apply to all cities.', 'woocommerce' ) ); ?></th>
|
||||
<th width="8%"><?php _e( 'Rate %', 'woocommerce' ); ?> <?php echo wc_help_tip( __( 'Enter a tax rate (percentage) to 4 decimal places.', 'woocommerce' ) ); ?></th>
|
||||
<th width="8%"><?php _e( 'Tax name', 'woocommerce' ); ?> <?php echo wc_help_tip( __( 'Enter a name for this tax rate.', 'woocommerce' ) ); ?></th>
|
||||
<th width="8%"><?php _e( 'Tax name', 'woocommerce' ); ?> <?php echo wc_help_tip( __( 'Enter a name for this tax rate.', 'woocommerce' ) ); ?></th>
|
||||
<th width="8%"><?php _e( 'Priority', 'woocommerce' ); ?> <?php echo wc_help_tip( __( 'Choose a priority for this tax rate. Only 1 matching rate per priority will be used. To define multiple tax rates for a single area you need to specify a different priority per rate.', 'woocommerce' ) ); ?></th>
|
||||
<th width="8%"><?php _e( 'Compound', 'woocommerce' ); ?> <?php echo wc_help_tip( __( 'Choose whether or not this is a compound rate. Compound tax rates are applied on top of other tax rates.', 'woocommerce' ) ); ?></th>
|
||||
<th width="8%"><?php _e( 'Shipping', 'woocommerce' ); ?> <?php echo wc_help_tip( __( 'Choose whether or not this tax rate also gets applied to shipping.', 'woocommerce' ) ); ?></th>
|
||||
|
|
|
@ -489,7 +489,7 @@ $pages = $system_status->get_pages();
|
|||
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . __( 'Page ID is set, but the page does not exist', 'woocommerce' ) . '</mark>';
|
||||
$error = true;
|
||||
} elseif ( ! $page['page_visible'] ) {
|
||||
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( 'Page visibility should be %1$spublic%2$s', 'woocommerce' ), '<a href="https://codex.wordpress.org/Content_Visibility" target="_blank">', '</a>' ) . '</mark>';
|
||||
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( 'Page visibility should be <a href="%s" target="_blank">public</a>', 'woocommerce' ), 'https://codex.wordpress.org/Content_Visibility' ) . '</mark>';
|
||||
$error = true;
|
||||
} else {
|
||||
// Shortcode check
|
||||
|
|
|
@ -11,7 +11,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
<div id="message" class="updated woocommerce-message wc-connect">
|
||||
<a class="woocommerce-message-close notice-dismiss" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wc-hide-notice', 'theme_support' ), 'woocommerce_hide_notices_nonce', '_wc_notice_nonce' ) ); ?>"><?php _e( 'Dismiss', 'woocommerce' ); ?></a>
|
||||
|
||||
<p><?php printf( __( '<strong>Your theme does not declare WooCommerce support</strong> – Please read our %1$sintegration%2$s guide or check out our %3$sStorefront%4$s theme which is totally free to download and designed specifically for use with WooCommerce.', 'woocommerce' ), '<a target="_blank" href="' . esc_url( apply_filters( 'woocommerce_docs_url', 'https://docs.woocommerce.com/document/third-party-custom-theme-compatibility/', 'theme-compatibility' ) ) . '">', '</a>', '<a target="_blank" href="' . esc_url( admin_url( 'theme-install.php?theme=storefront' ) ) . '">', '</a>' ); ?></p>
|
||||
<p><?php printf( __( '<strong>Your theme does not declare WooCommerce support</strong> – Please read our <a href="%1$s" target="_blank">integration</a> guide or check out our <a href="%2$s" target="_blank">Storefront</a> theme which is totally free to download and designed specifically for use with WooCommerce.', 'woocommerce' ), esc_url( apply_filters( 'woocommerce_docs_url', 'https://docs.woocommerce.com/document/third-party-custom-theme-compatibility/', 'theme-compatibility' ) ), esc_url( admin_url( 'theme-install.php?theme=storefront' ) ) ); ?></p>
|
||||
<p class="submit">
|
||||
<a href="https://woocommerce.com/storefront/?utm_source=notice&utm_medium=product&utm_content=storefront&utm_campaign=woocommerceplugin" class="button-primary" target="_blank"><?php _e( 'Read more about Storefront', 'woocommerce' ); ?></a>
|
||||
<a href="<?php echo esc_url( apply_filters( 'woocommerce_docs_url', 'http://docs.woocommerce.com/document/third-party-custom-theme-compatibility/?utm_source=notice&utm_medium=product&utm_content=themecompatibility&utm_campaign=woocommerceplugin' ) ); ?>" class="button-secondary" target="_blank"><?php _e( 'Theme integration guide', 'woocommerce' ); ?></a>
|
||||
|
|
|
@ -232,7 +232,7 @@ class WC_REST_Coupons_Controller extends WC_REST_Legacy_Coupons_Controller {
|
|||
if ( ! is_null( $value ) ) {
|
||||
switch ( $key ) {
|
||||
case 'code' :
|
||||
$coupon_code = apply_filters( 'woocommerce_coupon_code', $value );
|
||||
$coupon_code = wc_format_coupon_code( $value );
|
||||
$id = $coupon->get_id() ? $coupon->get_id() : 0;
|
||||
$id_from_code = wc_get_coupon_id_by_code( $coupon_code, $id );
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ class WC_REST_Legacy_Coupons_Controller extends WC_REST_CRUD_Controller {
|
|||
if ( ! is_null( $value ) ) {
|
||||
switch ( $key ) {
|
||||
case 'code' :
|
||||
$coupon_code = apply_filters( 'woocommerce_coupon_code', $value );
|
||||
$coupon_code = wc_format_coupon_code( $value );
|
||||
$id = $coupon->get_id() ? $coupon->get_id() : 0;
|
||||
$id_from_code = wc_get_coupon_id_by_code( $coupon_code, $id );
|
||||
|
||||
|
|
|
@ -222,7 +222,7 @@ class WC_API_Coupons extends WC_API_Resource {
|
|||
throw new WC_API_Exception( 'woocommerce_api_missing_coupon_code', sprintf( __( 'Missing parameter %s', 'woocommerce' ), 'code' ), 400 );
|
||||
}
|
||||
|
||||
$coupon_code = apply_filters( 'woocommerce_coupon_code', $data['code'] );
|
||||
$coupon_code = wc_format_coupon_code( $data['code'] );
|
||||
$id_from_code = wc_get_coupon_id_by_code( $coupon_code );
|
||||
|
||||
if ( $id_from_code ) {
|
||||
|
@ -329,7 +329,7 @@ class WC_API_Coupons extends WC_API_Resource {
|
|||
if ( isset( $data['code'] ) ) {
|
||||
global $wpdb;
|
||||
|
||||
$coupon_code = apply_filters( 'woocommerce_coupon_code', $data['code'] );
|
||||
$coupon_code = wc_format_coupon_code( $data['code'] );
|
||||
$id_from_code = wc_get_coupon_id_by_code( $coupon_code, $id );
|
||||
|
||||
if ( $id_from_code ) {
|
||||
|
|
|
@ -222,7 +222,7 @@ class WC_API_Coupons extends WC_API_Resource {
|
|||
throw new WC_API_Exception( 'woocommerce_api_missing_coupon_code', sprintf( __( 'Missing parameter %s', 'woocommerce' ), 'code' ), 400 );
|
||||
}
|
||||
|
||||
$coupon_code = apply_filters( 'woocommerce_coupon_code', $data['code'] );
|
||||
$coupon_code = wc_format_coupon_code( $data['code'] );
|
||||
$id_from_code = wc_get_coupon_id_by_code( $coupon_code );
|
||||
|
||||
if ( $id_from_code ) {
|
||||
|
@ -329,7 +329,7 @@ class WC_API_Coupons extends WC_API_Resource {
|
|||
if ( isset( $data['code'] ) ) {
|
||||
global $wpdb;
|
||||
|
||||
$coupon_code = apply_filters( 'woocommerce_coupon_code', $data['code'] );
|
||||
$coupon_code = wc_format_coupon_code( $data['code'] );
|
||||
$id_from_code = wc_get_coupon_id_by_code( $coupon_code, $id );
|
||||
|
||||
if ( $id_from_code ) {
|
||||
|
|
|
@ -257,7 +257,7 @@ class WC_REST_Coupons_V1_Controller extends WC_REST_Posts_Controller {
|
|||
if ( ! is_null( $value ) ) {
|
||||
switch ( $key ) {
|
||||
case 'code' :
|
||||
$coupon_code = apply_filters( 'woocommerce_coupon_code', $value );
|
||||
$coupon_code = wc_format_coupon_code( $value );
|
||||
$id = $coupon->get_id() ? $coupon->get_id() : 0;
|
||||
$id_from_code = wc_get_coupon_id_by_code( $coupon_code, $id );
|
||||
|
||||
|
|
|
@ -744,22 +744,28 @@ class WC_AJAX {
|
|||
}
|
||||
|
||||
try {
|
||||
$item_to_add = absint( $_POST['item_to_add'] );
|
||||
$order_id = absint( $_POST['order_id'] );
|
||||
$order = wc_get_order( $order_id );
|
||||
$order_id = absint( $_POST['order_id'] );
|
||||
$order = wc_get_order( $order_id );
|
||||
$items_to_add = wp_parse_id_list( is_array( $_POST['item_to_add'] ) ? $_POST['item_to_add'] : array( $_POST['item_to_add'] ) );
|
||||
|
||||
if ( ! $order || ! in_array( get_post_type( $item_to_add ), array( 'product', 'product_variation' ) ) ) {
|
||||
throw new Exception( __( 'Invalid product', 'woocommerce' ) );
|
||||
if ( ! $order ) {
|
||||
throw new Exception( __( 'Invalid order', 'woocommerce' ) );
|
||||
}
|
||||
|
||||
$item_id = $order->add_product( wc_get_product( $item_to_add ) );
|
||||
$item = apply_filters( 'woocommerce_ajax_order_item', $order->get_item( $item_id ), $item_id );
|
||||
$order_taxes = $order->get_taxes();
|
||||
$class = 'new_row';
|
||||
|
||||
ob_start();
|
||||
do_action( 'woocommerce_ajax_add_order_item_meta', $item_id, $item );
|
||||
include( 'admin/meta-boxes/views/html-order-item.php' );
|
||||
|
||||
foreach ( $items_to_add as $item_to_add ) {
|
||||
if ( ! in_array( get_post_type( $item_to_add ), array( 'product', 'product_variation' ) ) ) {
|
||||
continue;
|
||||
}
|
||||
$item_id = $order->add_product( wc_get_product( $item_to_add ) );
|
||||
$item = apply_filters( 'woocommerce_ajax_order_item', $order->get_item( $item_id ), $item_id );
|
||||
$order_taxes = $order->get_taxes();
|
||||
$class = 'new_row';
|
||||
|
||||
do_action( 'woocommerce_ajax_add_order_item_meta', $item_id, $item );
|
||||
include( 'admin/meta-boxes/views/html-order-item.php' );
|
||||
}
|
||||
|
||||
wp_send_json_success( array(
|
||||
'html' => ob_get_clean(),
|
||||
|
@ -932,7 +938,7 @@ class WC_AJAX {
|
|||
$_product = $order_item->get_product();
|
||||
if ( $_product->exists() && $_product->managing_stock() && isset( $order_item_qty[ $item_id ] ) && $order_item_qty[ $item_id ] > 0 ) {
|
||||
$stock_change = apply_filters( 'woocommerce_reduce_order_stock_quantity', $order_item_qty[ $item_id ], $item_id );
|
||||
$new_stock = $_product->reduce_stock( $stock_change );
|
||||
$new_stock = wc_update_product_stock( $_product, $stock_change, 'decrease' );
|
||||
$item_name = $_product->get_sku() ? $_product->get_sku() : $_product->get_id();
|
||||
$note = sprintf( __( 'Item %1$s stock reduced from %2$s to %3$s.', 'woocommerce' ), $item_name, $new_stock + $stock_change, $new_stock );
|
||||
$return[] = $note;
|
||||
|
@ -972,7 +978,7 @@ class WC_AJAX {
|
|||
if ( $_product->exists() && $_product->managing_stock() && isset( $order_item_qty[ $item_id ] ) && $order_item_qty[ $item_id ] > 0 ) {
|
||||
$old_stock = $_product->get_stock_quantity();
|
||||
$stock_change = apply_filters( 'woocommerce_restore_order_stock_quantity', $order_item_qty[ $item_id ], $item_id );
|
||||
$new_quantity = $_product->increase_stock( $stock_change );
|
||||
$new_quantity = wc_update_product_stock( $_product, $stock_change, 'increase' );
|
||||
$item_name = $_product->get_sku() ? $_product->get_sku() : $_product->get_id();
|
||||
$note = sprintf( __( 'Item %1$s stock increased from %2$s to %3$s.', 'woocommerce' ), $item_name, $old_stock, $new_quantity );
|
||||
$return[] = $note;
|
||||
|
|
|
@ -477,7 +477,7 @@ class WC_Cart {
|
|||
*/
|
||||
if ( ! $product->is_in_stock() ) {
|
||||
/* translators: %s: product name */
|
||||
$error->add( 'out-of-stock', sprintf( __( 'Sorry, "%s" is not in stock. Please edit your cart and try again. We apologise for any inconvenience caused.', 'woocommerce' ), $product->get_name() ) );
|
||||
$error->add( 'out-of-stock', sprintf( __( 'Sorry, "%s" is not in stock. Please edit your cart and try again. We apologize for any inconvenience caused.', 'woocommerce' ), $product->get_name() ) );
|
||||
return $error;
|
||||
}
|
||||
|
||||
|
@ -490,7 +490,7 @@ class WC_Cart {
|
|||
*/
|
||||
if ( ! $product->has_enough_stock( $product_qty_in_cart[ $product->get_stock_managed_by_id() ] ) ) {
|
||||
/* translators: 1: product name 2: quantity in stock */
|
||||
$error->add( 'out-of-stock', sprintf( __( 'Sorry, we do not have enough "%1$s" in stock to fulfill your order (%2$s in stock). Please edit your cart and try again. We apologise for any inconvenience caused.', 'woocommerce' ), $product->get_name(), wc_format_stock_quantity_for_display( $product->get_stock_quantity(), $product ) ) );
|
||||
$error->add( 'out-of-stock', sprintf( __( 'Sorry, we do not have enough "%1$s" in stock to fulfill your order (%2$s in stock). Please edit your cart and try again. We apologize for any inconvenience caused.', 'woocommerce' ), $product->get_name(), wc_format_stock_quantity_for_display( $product->get_stock_quantity(), $product ) ) );
|
||||
return $error;
|
||||
}
|
||||
|
||||
|
@ -519,7 +519,7 @@ class WC_Cart {
|
|||
|
||||
if ( $product->get_stock_quantity() < ( $held_stock + $product_qty_in_cart[ $product->get_stock_managed_by_id() ] ) ) {
|
||||
/* translators: 1: product name 2: minutes */
|
||||
$error->add( 'out-of-stock', sprintf( __( 'Sorry, we do not have enough "%1$s" in stock to fulfill your order right now. Please try again in %2$d minutes or edit your cart and try again. We apologise for any inconvenience caused.', 'woocommerce' ), $product->get_name(), get_option( 'woocommerce_hold_stock_minutes' ) ) );
|
||||
$error->add( 'out-of-stock', sprintf( __( 'Sorry, we do not have enough "%1$s" in stock to fulfill your order right now. Please try again in %2$d minutes or edit your cart and try again. We apologize for any inconvenience caused.', 'woocommerce' ), $product->get_name(), get_option( 'woocommerce_hold_stock_minutes' ) ) );
|
||||
return $error;
|
||||
}
|
||||
}
|
||||
|
@ -1703,7 +1703,7 @@ class WC_Cart {
|
|||
* @return bool
|
||||
*/
|
||||
public function has_discount( $coupon_code = '' ) {
|
||||
return $coupon_code ? in_array( apply_filters( 'woocommerce_coupon_code', $coupon_code ), $this->applied_coupons ) : sizeof( $this->applied_coupons ) > 0;
|
||||
return $coupon_code ? in_array( wc_format_coupon_code( $coupon_code ), $this->applied_coupons ) : sizeof( $this->applied_coupons ) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1719,7 +1719,7 @@ class WC_Cart {
|
|||
}
|
||||
|
||||
// Sanitize coupon code
|
||||
$coupon_code = apply_filters( 'woocommerce_coupon_code', $coupon_code );
|
||||
$coupon_code = wc_format_coupon_code( $coupon_code );
|
||||
|
||||
// Get the coupon
|
||||
$the_coupon = new WC_Coupon( $coupon_code );
|
||||
|
@ -1852,7 +1852,7 @@ class WC_Cart {
|
|||
}
|
||||
|
||||
// Get the coupon
|
||||
$coupon_code = apply_filters( 'woocommerce_coupon_code', $coupon_code );
|
||||
$coupon_code = wc_format_coupon_code( $coupon_code );
|
||||
$position = array_search( $coupon_code, $this->applied_coupons );
|
||||
|
||||
if ( false !== $position ) {
|
||||
|
@ -1890,12 +1890,12 @@ class WC_Cart {
|
|||
$discount_amount = min( $price, $discount_amount );
|
||||
$price = max( $price - $discount_amount, 0 );
|
||||
|
||||
// Store the totals for DISPLAY in the cart
|
||||
// Store the totals for DISPLAY in the cart.
|
||||
if ( $add_totals ) {
|
||||
$total_discount = $discount_amount * $values['quantity'];
|
||||
$total_discount_tax = 0;
|
||||
|
||||
if ( wc_tax_enabled() ) {
|
||||
if ( wc_tax_enabled() && $product->is_taxable() ) {
|
||||
$tax_rates = WC_Tax::get_rates( $product->get_tax_class() );
|
||||
$taxes = WC_Tax::calc_tax( $discount_amount, $tax_rates, $this->prices_include_tax );
|
||||
$total_discount_tax = WC_Tax::get_tax_total( $taxes ) * $values['quantity'];
|
||||
|
@ -1953,16 +1953,19 @@ class WC_Cart {
|
|||
/**
|
||||
* Add additional fee to the cart.
|
||||
*
|
||||
* @param string $name Unique name for the fee. Multiple fees of the same name cannot be added.
|
||||
* @param float $amount Fee amount.
|
||||
* @param bool $taxable (default: false) Is the fee taxable?
|
||||
* @param string $tax_class (default: '') The tax class for the fee if taxable. A blank string is standard tax class.
|
||||
* Fee is an amount of money charged for a particular piece of work
|
||||
* or for a particular right or service, and not supposed to be negative.
|
||||
*
|
||||
* @param string $name Unique name for the fee. Multiple fees of the same name cannot be added.
|
||||
* @param float $amount Fee amount (do not enter negative amounts).
|
||||
* @param bool $taxable Is the fee taxable? (default: false).
|
||||
* @param string $tax_class The tax class for the fee if taxable. A blank string is standard tax class. (default: '').
|
||||
*/
|
||||
public function add_fee( $name, $amount, $taxable = false, $tax_class = '' ) {
|
||||
|
||||
$new_fee_id = sanitize_title( $name );
|
||||
|
||||
// Only add each fee once
|
||||
// Only add each fee once.
|
||||
foreach ( $this->fees as $fee ) {
|
||||
if ( $fee->id == $new_fee_id ) {
|
||||
return;
|
||||
|
@ -2003,10 +2006,6 @@ class WC_Cart {
|
|||
// If fees were added, total them and calculate tax
|
||||
if ( ! empty( $this->fees ) ) {
|
||||
foreach ( $this->fees as $fee_key => $fee ) {
|
||||
if ( $fee->amount < 0 ) {
|
||||
wc_doing_it_wrong( __FUNCTION__, __( 'Fees should not be negative.', 'woocommerce' ), '2.7' );
|
||||
continue;
|
||||
}
|
||||
$this->fee_total += $fee->amount;
|
||||
|
||||
if ( $fee->taxable ) {
|
||||
|
|
|
@ -202,7 +202,6 @@ class WC_Checkout {
|
|||
'label' => __( 'Account username', 'woocommerce' ),
|
||||
'required' => true,
|
||||
'placeholder' => esc_attr__( 'Username', 'woocommerce' ),
|
||||
'autocomplete' => 'username',
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -212,7 +211,6 @@ class WC_Checkout {
|
|||
'label' => __( 'Account password', 'woocommerce' ),
|
||||
'required' => true,
|
||||
'placeholder' => esc_attr__( 'Password', 'woocommerce' ),
|
||||
'autocomplete' => 'password',
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -618,10 +616,10 @@ class WC_Checkout {
|
|||
}
|
||||
}
|
||||
|
||||
if ( in_array( 'email', $format ) ) {
|
||||
if ( in_array( 'email', $format ) && '' !== $data[ $key ] ) {
|
||||
$data[ $key ] = sanitize_email( $data[ $key ] );
|
||||
|
||||
if ( '' !== $data[ $key ] && ! is_email( $data[ $key ] ) ) {
|
||||
if ( ! is_email( $data[ $key ] ) ) {
|
||||
/* translators: %s: email address */
|
||||
$errors->add( 'validation', sprintf( __( '%s is not a valid email address.', 'woocommerce' ), '<strong>' . $field_label . '</strong>' ) );
|
||||
}
|
||||
|
@ -834,8 +832,14 @@ class WC_Checkout {
|
|||
// Add customer info from other fields.
|
||||
if ( $customer_id && apply_filters( 'woocommerce_checkout_update_customer_data', true, $this ) ) {
|
||||
$customer = new WC_Customer( $customer_id );
|
||||
$customer->set_first_name( $data['billing_first_name'] );
|
||||
$customer->set_last_name( $data['billing_last_name'] );
|
||||
|
||||
if ( ! empty( $data['billing_first_name'] ) ) {
|
||||
$customer->set_first_name( $data['billing_first_name'] );
|
||||
}
|
||||
|
||||
if ( ! empty( $data['billing_last_name'] ) ) {
|
||||
$customer->set_last_name( $data['billing_last_name'] );
|
||||
}
|
||||
|
||||
foreach ( $data as $key => $value ) {
|
||||
// Use setters where available.
|
||||
|
|
|
@ -182,23 +182,16 @@ class WC_Comments {
|
|||
|
||||
/**
|
||||
* Validate the comment ratings.
|
||||
*
|
||||
* @param array $comment_data
|
||||
* @return array
|
||||
*/
|
||||
public static function check_comment_rating( $comment_data ) {
|
||||
// If posting a comment (not trackback etc) and not logged in
|
||||
if (
|
||||
! is_admin()
|
||||
&& 'product' === get_post_type( $_POST['comment_post_ID'] )
|
||||
&& empty( $_POST['rating'] )
|
||||
&& '' === $comment_data['comment_type']
|
||||
&& 'yes' === get_option( 'woocommerce_enable_review_rating' )
|
||||
&& 'yes' === get_option( 'woocommerce_review_rating_required' )
|
||||
) {
|
||||
if ( ! is_admin() && isset( $_POST['comment_post_ID'], $_POST['rating'], $comment_data['comment_type'] ) && 'product' === get_post_type( $_POST['comment_post_ID'] ) && empty( $_POST['rating'] ) && '' === $comment_data['comment_type'] && 'yes' === get_option( 'woocommerce_enable_review_rating' ) && 'yes' === get_option( 'woocommerce_review_rating_required' ) ) {
|
||||
wp_die( __( 'Please rate the product.', 'woocommerce' ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
return $comment_data;
|
||||
}
|
||||
|
||||
|
|
|
@ -100,7 +100,12 @@ class WC_Customer extends WC_Legacy_Customer {
|
|||
|
||||
// If we have an ID, load the user from the DB.
|
||||
if ( $this->get_id() ) {
|
||||
$this->data_store->read( $this );
|
||||
try {
|
||||
$this->data_store->read( $this );
|
||||
} catch ( Exception $e ) {
|
||||
$this->set_id( 0 );
|
||||
$this->set_object_read( true );
|
||||
}
|
||||
} else {
|
||||
$this->set_object_read( true );
|
||||
}
|
||||
|
|
|
@ -103,17 +103,24 @@ class WC_Emails {
|
|||
/**
|
||||
* Init the mailer instance and call the notifications for the current filter.
|
||||
*
|
||||
* @internal param array $args (default: array())
|
||||
* @internal
|
||||
*
|
||||
* @param string $filter Filter name.
|
||||
* @param array $args Email args (default: []).
|
||||
*/
|
||||
public static function send_queued_transactional_email( $filter = '', $args = array() ) {
|
||||
self::instance(); // Init self so emails exist.
|
||||
do_action_ref_array( $filter . '_notification', $args );
|
||||
if ( apply_filters( 'woocommerce_allow_send_queued_transactional_email', true, $filter, $args ) ) {
|
||||
self::instance(); // Init self so emails exist.
|
||||
do_action_ref_array( $filter . '_notification', $args );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Init the mailer instance and call the notifications for the current filter.
|
||||
*
|
||||
* @internal param array $args (default: array())
|
||||
* @internal
|
||||
*
|
||||
* @param array $args Email args (default: []).
|
||||
*/
|
||||
public static function send_transactional_email( $args = array() ) {
|
||||
$args = func_get_args();
|
||||
|
@ -359,12 +366,15 @@ class WC_Emails {
|
|||
/**
|
||||
* Add customer details to email templates.
|
||||
*
|
||||
* @param mixed $order
|
||||
* @param WC_Order $order
|
||||
* @param bool $sent_to_admin (default: false)
|
||||
* @param bool $plain_text (default: false)
|
||||
* @return string
|
||||
*/
|
||||
public function customer_details( $order, $sent_to_admin = false, $plain_text = false ) {
|
||||
if ( ! is_a( 'WC_Order', $order ) ) {
|
||||
return;
|
||||
}
|
||||
$fields = array();
|
||||
|
||||
if ( $order->get_customer_note() ) {
|
||||
|
@ -379,14 +389,14 @@ class WC_Emails {
|
|||
'label' => __( 'Email address', 'woocommerce' ),
|
||||
'value' => wptexturize( $order->get_billing_email() ),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ( $order->get_billing_phone() ) {
|
||||
if ( $order->get_billing_phone() ) {
|
||||
$fields['billing_phone'] = array(
|
||||
'label' => __( 'Phone', 'woocommerce' ),
|
||||
'value' => wptexturize( $order->get_billing_phone() ),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$fields = array_filter( apply_filters( 'woocommerce_email_customer_details_fields', $fields, $sent_to_admin, $order ), array( $this, 'customer_detail_field_is_valid' ) );
|
||||
|
||||
|
@ -401,6 +411,9 @@ class WC_Emails {
|
|||
* Get the email addresses.
|
||||
*/
|
||||
public function email_addresses( $order, $sent_to_admin = false, $plain_text = false ) {
|
||||
if ( ! is_a( 'WC_Order', $order ) ) {
|
||||
return;
|
||||
}
|
||||
if ( $plain_text ) {
|
||||
wc_get_template( 'emails/plain/email-addresses.php', array( 'order' => $order ) );
|
||||
} else {
|
||||
|
|
|
@ -6,6 +6,9 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
/**
|
||||
* Order Line Item (fee).
|
||||
*
|
||||
* Fee is an amount of money charged for a particular piece of work
|
||||
* or for a particular right or service, and not supposed to be negative.
|
||||
*
|
||||
* @version 2.7.0
|
||||
* @since 2.7.0
|
||||
* @package WooCommerce/Classes
|
||||
|
@ -64,21 +67,21 @@ class WC_Order_Item_Fee extends WC_Order_Item {
|
|||
/**
|
||||
* Set total.
|
||||
*
|
||||
* @param string $value
|
||||
* @param string $amount Fee amount (do not enter negative amounts).
|
||||
* @throws WC_Data_Exception
|
||||
*/
|
||||
public function set_total( $value ) {
|
||||
$this->set_prop( 'total', wc_format_decimal( $value ) );
|
||||
public function set_total( $amount ) {
|
||||
$this->set_prop( 'total', wc_format_decimal( $amount ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set total tax.
|
||||
*
|
||||
* @param string $value
|
||||
* @param string $amount
|
||||
* @throws WC_Data_Exception
|
||||
*/
|
||||
protected function set_total_tax( $value ) {
|
||||
$this->set_prop( 'total_tax', wc_format_decimal( $value ) );
|
||||
protected function set_total_tax( $amount ) {
|
||||
$this->set_prop( 'total_tax', wc_format_decimal( $amount ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -209,4 +209,55 @@ class WC_Order_Item_Tax extends WC_Order_Item {
|
|||
public function is_compound() {
|
||||
return $this->get_compound();
|
||||
}
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Array Access Methods
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| For backwards compat with legacy arrays.
|
||||
|
|
||||
*/
|
||||
|
||||
/**
|
||||
* offsetGet for ArrayAccess/Backwards compatibility.
|
||||
* @deprecated Add deprecation notices in future release.
|
||||
* @param string $offset
|
||||
* @return mixed
|
||||
*/
|
||||
public function offsetGet( $offset ) {
|
||||
if ( 'tax_amount' === $offset ) {
|
||||
$offset = 'tax_total';
|
||||
} elseif ( 'shipping_tax_amount' === $offset ) {
|
||||
$offset = 'shipping_tax_total';
|
||||
}
|
||||
return parent::offsetGet( $offset );
|
||||
}
|
||||
|
||||
/**
|
||||
* offsetSet for ArrayAccess/Backwards compatibility.
|
||||
* @deprecated Add deprecation notices in future release.
|
||||
* @param string $offset
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function offsetSet( $offset, $value ) {
|
||||
if ( 'tax_amount' === $offset ) {
|
||||
$offset = 'tax_total';
|
||||
} elseif ( 'shipping_tax_amount' === $offset ) {
|
||||
$offset = 'shipping_tax_total';
|
||||
}
|
||||
parent::offsetSet( $offset, $value );
|
||||
}
|
||||
|
||||
/**
|
||||
* offsetExists for ArrayAccess
|
||||
* @param string $offset
|
||||
* @return bool
|
||||
*/
|
||||
public function offsetExists( $offset ) {
|
||||
if ( in_array( $offset, array( 'tax_amount', 'shipping_tax_amount' ) ) ) {
|
||||
return true;
|
||||
}
|
||||
return parent::offsetExists( $offset );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -252,7 +252,7 @@ class WC_Order_Item extends WC_Data implements ArrayAccess {
|
|||
}
|
||||
}
|
||||
|
||||
$this->update_meta_data( '_' . $offset, $value );
|
||||
$this->update_meta_data( $offset, $value );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -275,7 +275,7 @@ class WC_Order_Item extends WC_Data implements ArrayAccess {
|
|||
unset( $this->changes[ $offset ] );
|
||||
}
|
||||
|
||||
$this->delete_meta_data( '_' . $offset );
|
||||
$this->delete_meta_data( $offset );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -288,7 +288,7 @@ class WC_Order_Item extends WC_Data implements ArrayAccess {
|
|||
if ( 'item_meta_array' === $offset || 'item_meta' === $offset || array_key_exists( $offset, $this->data ) ) {
|
||||
return true;
|
||||
}
|
||||
return array_key_exists( '_' . $offset, wp_list_pluck( $this->meta_data, 'value', 'key' ) );
|
||||
return array_key_exists( $offset, wp_list_pluck( $this->meta_data, 'value', 'key' ) ) || array_key_exists( '_' . $offset, wp_list_pluck( $this->meta_data, 'value', 'key' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -298,6 +298,7 @@ class WC_Order_Item extends WC_Data implements ArrayAccess {
|
|||
*/
|
||||
public function offsetGet( $offset ) {
|
||||
$this->maybe_read_meta_data();
|
||||
|
||||
if ( 'item_meta_array' === $offset ) {
|
||||
$return = array();
|
||||
|
||||
|
@ -322,6 +323,8 @@ class WC_Order_Item extends WC_Data implements ArrayAccess {
|
|||
} elseif ( array_key_exists( '_' . $offset, $meta_values ) ) {
|
||||
// Item meta was expanded in previous versions, with prefixes removed. This maintains support.
|
||||
return $meta_values[ '_' . $offset ];
|
||||
} elseif ( array_key_exists( $offset, $meta_values ) ) {
|
||||
return $meta_values[ $offset ];
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -1568,7 +1568,7 @@ class WC_Order extends WC_Abstract_Order {
|
|||
|
||||
foreach ( $this->get_refunds() as $refund ) {
|
||||
foreach ( $refund->get_items( $item_type ) as $refunded_item ) {
|
||||
$count += $refunded_item->get_quantity();
|
||||
$count += abs( $refunded_item->get_quantity() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1685,4 +1685,35 @@ class WC_Order extends WC_Abstract_Order {
|
|||
public function get_remaining_refund_items() {
|
||||
return absint( $this->get_item_count() - $this->get_item_count_refunded() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get totals for display on pages and in emails.
|
||||
*
|
||||
* @param mixed $tax_display
|
||||
* @return array
|
||||
*/
|
||||
public function get_order_item_totals( $tax_display = '' ) {
|
||||
$total_rows = parent::get_order_item_totals( $tax_display );
|
||||
$total_row = array_pop( $total_rows );
|
||||
|
||||
if ( $this->get_total() > 0 && $this->get_payment_method_title() ) {
|
||||
$total_rows['payment_method'] = array(
|
||||
'label' => __( 'Payment method:', 'woocommerce' ),
|
||||
'value' => $this->get_payment_method_title(),
|
||||
);
|
||||
}
|
||||
|
||||
if ( $refunds = $this->get_refunds() ) {
|
||||
foreach ( $refunds as $id => $refund ) {
|
||||
$total_rows[ 'refund_' . $id ] = array(
|
||||
'label' => $refund->get_reason() ? $refund->get_reason() : __( 'Refund', 'woocommerce' ) . ':',
|
||||
'value' => wc_price( '-' . $refund->get_amount(), array( 'currency' => $this->get_currency() ) ),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$total_rows['order_total'] = $total_row;
|
||||
|
||||
return apply_filters( 'woocommerce_get_order_item_totals', $total_rows, $this );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -248,14 +248,18 @@ class WC_Structured_Data {
|
|||
$markup['@id'] = get_comment_link( $comment->comment_ID );
|
||||
$markup['datePublished'] = get_comment_date( 'c', $comment->comment_ID );
|
||||
$markup['description'] = get_comment_text( $comment->comment_ID );
|
||||
$markup['itemReviewed'] = array(
|
||||
'@type' => 'Product',
|
||||
'name' => get_the_title( $comment->post_ID ),
|
||||
);
|
||||
$markup['reviewRating'] = array(
|
||||
'@type' => 'rating',
|
||||
'ratingValue' => get_comment_meta( $comment->comment_ID, 'rating', true ),
|
||||
);
|
||||
|
||||
if ( $rating = get_comment_meta( $comment->comment_ID, 'rating', true ) ) {
|
||||
$markup['reviewRating'] = array(
|
||||
'@type' => 'rating',
|
||||
'ratingValue' => $rating,
|
||||
);
|
||||
|
||||
// Skip replies unless they have a rating.
|
||||
} elseif ( $comment->comment_parent ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$markup['author'] = array(
|
||||
'@type' => 'Person',
|
||||
'name' => get_comment_author( $comment->comment_ID ),
|
||||
|
@ -324,7 +328,7 @@ class WC_Structured_Data {
|
|||
* @param bool $plain_text Plain text email (default: false).
|
||||
*/
|
||||
public function generate_order_data( $order, $sent_to_admin = false, $plain_text = false ) {
|
||||
if ( $plain_text ) {
|
||||
if ( $plain_text || ! is_a( $order, 'WC_Order' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -114,6 +114,7 @@ class WC_Customer_Data_Store extends WC_Data_Store_WP implements WC_Customer_Dat
|
|||
*
|
||||
* @since 2.7.0
|
||||
* @param WC_Customer
|
||||
* @throws Exception
|
||||
*/
|
||||
public function read( &$customer ) {
|
||||
global $wpdb;
|
||||
|
|
|
@ -34,7 +34,7 @@ class WC_Product_Grouped_Data_Store_CPT extends WC_Product_Data_Store_CPT implem
|
|||
}
|
||||
}
|
||||
|
||||
parent::update_post_meta( $product );
|
||||
parent::update_post_meta( $product, $force );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -313,7 +313,7 @@ class WC_Product_Variable_Data_Store_CPT extends WC_Product_Data_Store_CPT imple
|
|||
WHERE post_type = 'product_variation'
|
||||
AND post_parent = %d
|
||||
",
|
||||
$previous_name,
|
||||
$previous_name ? $previous_name : __( 'Auto Draft' ),
|
||||
$new_name,
|
||||
$product->get_id()
|
||||
) );
|
||||
|
|
|
@ -70,12 +70,10 @@ class WC_Product_Variation_Data_Store_CPT extends WC_Product_Data_Store_CPT impl
|
|||
$product->set_attributes( wc_get_product_variation_attributes( $product->get_id() ) );
|
||||
|
||||
/**
|
||||
* Clean up old variation titles.
|
||||
* The "Product #" text is intentionally not wrapped in translation functions for a faster comparision. It was not inserted as a translated string:
|
||||
* https://github.com/woocommerce/woocommerce/blob/5fc88694d211e2e176bded16d7fb95cf6285249e/includes/class-wc-ajax.php#L776
|
||||
* If a variation title is not in sync with the parent e.g. saved prior to 2.7, or if the parent title has changed, detect here and update.
|
||||
*/
|
||||
if ( __( 'Variation #', 'woocommerce' ) === substr( $post_object->post_title, 0, 11 ) || ( 'Product #' . $product->get_parent_id() . ' Variation' ) === $post_object->post_title ) {
|
||||
$new_title = $this->generate_product_title( $product );
|
||||
if ( version_compare( get_post_meta( $product->get_id(), '_product_version', true ), '2.7', '<' ) && 0 !== strpos( $post_object->post_title, get_post_field( 'post_title', $product->get_parent_id() ) ) ) {
|
||||
$new_title = $this->generate_product_title( $product );
|
||||
$product->set_name( $new_title );
|
||||
wp_update_post( array(
|
||||
'ID' => $product->get_id(),
|
||||
|
@ -198,9 +196,9 @@ class WC_Product_Variation_Data_Store_CPT extends WC_Product_Data_Store_CPT impl
|
|||
}
|
||||
|
||||
$include_attribute_names = apply_filters( 'woocommerce_product_variation_title_include_attribute_names', $include_attribute_names, $product );
|
||||
$title_base_text = get_post_field( 'post_title', $product->get_parent_id() );
|
||||
$title_attributes_text = wc_get_formatted_variation( $product, true, $include_attribute_names );
|
||||
$separator = ! empty( $title_attributes_text ) ? ' – ' : '';
|
||||
$title_base_text = get_post_field( 'post_title', $product->get_parent_id() );
|
||||
$title_attributes_text = wc_get_formatted_variation( $product, true, $include_attribute_names );
|
||||
$separator = ! empty( $title_attributes_text ) ? ' – ' : '';
|
||||
|
||||
return apply_filters( 'woocommerce_product_variation_title',
|
||||
$title_base_text . $separator . $title_attributes_text,
|
||||
|
@ -343,6 +341,6 @@ class WC_Product_Variation_Data_Store_CPT extends WC_Product_Data_Store_CPT impl
|
|||
}
|
||||
}
|
||||
|
||||
parent::update_post_meta( $product );
|
||||
parent::update_post_meta( $product, $force );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -279,20 +279,24 @@ class WC_Gateway_BACS extends WC_Payment_Gateway {
|
|||
$bacs_accounts = apply_filters( 'woocommerce_bacs_accounts', $this->account_details );
|
||||
|
||||
if ( ! empty( $bacs_accounts ) ) {
|
||||
echo '<h2 class="wc-bacs-bank-details-heading">' . __( 'Our bank details', 'woocommerce' ) . '</h2>' . PHP_EOL;
|
||||
$account_html = '';
|
||||
$has_details = false;
|
||||
|
||||
foreach ( $bacs_accounts as $bacs_account ) {
|
||||
|
||||
$bacs_account = (object) $bacs_account;
|
||||
|
||||
if ( $bacs_account->account_name || $bacs_account->bank_name ) {
|
||||
echo '<h3>' . wp_unslash( implode( ' - ', array_filter( array( $bacs_account->account_name, $bacs_account->bank_name ) ) ) ) . '</h3>' . PHP_EOL;
|
||||
if ( $bacs_account->account_name ) {
|
||||
$account_html .= '<h3 class="wc-bacs-bank-details-account-name">' . wp_kses_post( wp_unslash( $bacs_account->account_name ) ) . ':</h3>' . PHP_EOL;
|
||||
}
|
||||
|
||||
echo '<ul class="wc-bacs-bank-details order_details bacs_details">' . PHP_EOL;
|
||||
$account_html .= '<ul class="wc-bacs-bank-details order_details bacs_details">' . PHP_EOL;
|
||||
|
||||
// BACS account fields shown on the thanks page and in emails
|
||||
$account_fields = apply_filters( 'woocommerce_bacs_account_fields', array(
|
||||
'bank_name' => array(
|
||||
'label' => __( 'Bank', 'woocommerce' ),
|
||||
'value' => $bacs_account->bank_name,
|
||||
),
|
||||
'account_number' => array(
|
||||
'label' => __( 'Account number', 'woocommerce' ),
|
||||
'value' => $bacs_account->account_number,
|
||||
|
@ -313,11 +317,16 @@ class WC_Gateway_BACS extends WC_Payment_Gateway {
|
|||
|
||||
foreach ( $account_fields as $field_key => $field ) {
|
||||
if ( ! empty( $field['value'] ) ) {
|
||||
echo '<li class="' . esc_attr( $field_key ) . '">' . esc_attr( $field['label'] ) . ': <strong>' . wptexturize( $field['value'] ) . '</strong></li>' . PHP_EOL;
|
||||
$account_html .= '<li class="' . esc_attr( $field_key ) . '">' . wp_kses_post( $field['label'] ) . ': <strong>' . wp_kses_post( wptexturize( $field['value'] ) ) . '</strong></li>' . PHP_EOL;
|
||||
$has_details = true;
|
||||
}
|
||||
}
|
||||
|
||||
echo '</ul>';
|
||||
$account_html .= '</ul>';
|
||||
}
|
||||
|
||||
if ( $has_details ) {
|
||||
echo '<section class="woocommerce-bacs-bank-details"><h2 class="wc-bacs-bank-details-heading">' . __( 'Our bank details', 'woocommerce' ) . '</h2>' . PHP_EOL . $account_html . '</section>';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -94,9 +94,13 @@ abstract class WC_Abstract_Legacy_Order extends WC_Data {
|
|||
/**
|
||||
* Add a fee to the order.
|
||||
* Order must be saved prior to adding items.
|
||||
* @param object $fee
|
||||
* @return int updated order item ID
|
||||
*
|
||||
* Fee is an amount of money charged for a particular piece of work
|
||||
* or for a particular right or service, and not supposed to be negative.
|
||||
*
|
||||
* @throws WC_Data_Exception
|
||||
* @param object $fee Fee data.
|
||||
* @return int Updated order item ID.
|
||||
*/
|
||||
public function add_fee( $fee ) {
|
||||
wc_deprecated_function( 'WC_Order::add_fee', '2.7', 'a new WC_Order_Item_Fee object and add to order with WC_Order::add_item()' );
|
||||
|
@ -417,7 +421,7 @@ abstract class WC_Abstract_Legacy_Order extends WC_Data {
|
|||
} elseif ( 'status' === $key ) {
|
||||
return $this->get_status();
|
||||
} elseif ( 'post_status' === $key ) {
|
||||
return 'wc-' . $this->get_status();
|
||||
return get_post_status( $this->get_id() );
|
||||
} elseif ( 'customer_message' === $key || 'customer_note' === $key ) {
|
||||
return $this->get_customer_note();
|
||||
} elseif ( in_array( $key, array( 'user_id', 'customer_user' ) ) ) {
|
||||
|
@ -592,12 +596,14 @@ abstract class WC_Abstract_Legacy_Order extends WC_Data {
|
|||
protected function init( $order ) {
|
||||
wc_deprecated_function( 'init', '2.7', 'Logic moved to constructor' );
|
||||
if ( is_numeric( $order ) ) {
|
||||
$this->read( $order );
|
||||
$this->set_id( $order );
|
||||
} elseif ( $order instanceof WC_Order ) {
|
||||
$this->read( absint( $order->get_id() ) );
|
||||
$this->set_id( absint( $order->get_id() ) );
|
||||
} elseif ( isset( $order->ID ) ) {
|
||||
$this->read( absint( $order->ID ) );
|
||||
$this->set_id( absint( $order->ID ) );
|
||||
}
|
||||
$this->set_object_read( false );
|
||||
$this->data_store->read( $this );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -607,7 +613,7 @@ abstract class WC_Abstract_Legacy_Order extends WC_Data {
|
|||
* @return bool
|
||||
*/
|
||||
public function get_order( $id = 0 ) {
|
||||
wc_deprecated_function( 'get_order', '2.7', 'read' );
|
||||
wc_deprecated_function( 'get_order', '2.7' );
|
||||
if ( ! $id ) {
|
||||
return false;
|
||||
}
|
||||
|
@ -624,8 +630,10 @@ abstract class WC_Abstract_Legacy_Order extends WC_Data {
|
|||
* @param mixed $result
|
||||
*/
|
||||
public function populate( $result ) {
|
||||
wc_deprecated_function( 'populate', '2.7', 'read' );
|
||||
$this->read( $result->ID );
|
||||
wc_deprecated_function( 'populate', '2.7' );
|
||||
$this->set_id( $result->ID );
|
||||
$this->set_object_read( false );
|
||||
$this->data_store->read( $this );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -45,6 +45,13 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
|||
'variation_data',
|
||||
'variation_has_stock',
|
||||
'variation_shipping_class_id',
|
||||
'variation_has_sku',
|
||||
'variation_has_length',
|
||||
'variation_has_width',
|
||||
'variation_has_height',
|
||||
'variation_has_weight',
|
||||
'variation_has_tax_class',
|
||||
'variation_has_downloadable_files',
|
||||
) );
|
||||
}
|
||||
return in_array( $key, array_merge( $valid, array_keys( $this->data ) ) ) || metadata_exists( 'post', $this->get_id(), '_' . $key ) || metadata_exists( 'post', $this->get_parent_id(), '_' . $key );
|
||||
|
@ -127,6 +134,15 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
|
|||
case 'variation_shipping_class_id' :
|
||||
$value = $this->is_type( 'variation' ) ? $this->get_shipping_class_id() : '';
|
||||
break;
|
||||
case 'variation_has_sku' :
|
||||
case 'variation_has_length' :
|
||||
case 'variation_has_width' :
|
||||
case 'variation_has_height' :
|
||||
case 'variation_has_weight' :
|
||||
case 'variation_has_tax_class' :
|
||||
case 'variation_has_downloadable_files' :
|
||||
$value = true; // These were deprecated in 2.2 and simply returned true in 2.6.x.
|
||||
break;
|
||||
default :
|
||||
if ( in_array( $key, array_keys( $this->data ) ) ) {
|
||||
$value = $this->{"get_$key"}();
|
||||
|
|
|
@ -14,15 +14,15 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
class WC_Twenty_Seventeen {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* Theme init.
|
||||
*/
|
||||
public function __construct() {
|
||||
public static function init() {
|
||||
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 );
|
||||
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 );
|
||||
|
||||
add_action( 'woocommerce_before_main_content', array( $this, 'output_content_wrapper' ), 10 );
|
||||
add_action( 'woocommerce_after_main_content', array( $this, 'output_content_wrapper_end' ), 10 );
|
||||
add_filter( 'woocommerce_enqueue_styles', array( $this, 'enqueue_styles' ) );
|
||||
add_action( 'woocommerce_before_main_content', array( __CLASS__, 'output_content_wrapper' ), 10 );
|
||||
add_action( 'woocommerce_after_main_content', array( __CLASS__, 'output_content_wrapper_end' ), 10 );
|
||||
add_filter( 'woocommerce_enqueue_styles', array( __CLASS__, 'enqueue_styles' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -31,7 +31,7 @@ class WC_Twenty_Seventeen {
|
|||
* @param array $styles
|
||||
* @return array
|
||||
*/
|
||||
public function enqueue_styles( $styles ) {
|
||||
public static function enqueue_styles( $styles ) {
|
||||
unset( $styles['woocommerce-general'] );
|
||||
|
||||
$styles['woocommerce-twenty-seventeen'] = array(
|
||||
|
@ -47,7 +47,7 @@ class WC_Twenty_Seventeen {
|
|||
/**
|
||||
* Open the Twenty Seventeen wrapper.
|
||||
*/
|
||||
public function output_content_wrapper() { ?>
|
||||
public static function output_content_wrapper() { ?>
|
||||
<div class="wrap">
|
||||
<div id="primary" class="content-area twentyseventeen">
|
||||
<main id="main" class="site-main" role="main">
|
||||
|
@ -57,7 +57,7 @@ class WC_Twenty_Seventeen {
|
|||
/**
|
||||
* Close the Twenty Seventeen wrapper.
|
||||
*/
|
||||
public function output_content_wrapper_end() { ?>
|
||||
public static function output_content_wrapper_end() { ?>
|
||||
</main>
|
||||
</div>
|
||||
<?php get_sidebar(); ?>
|
||||
|
@ -66,4 +66,4 @@ class WC_Twenty_Seventeen {
|
|||
}
|
||||
}
|
||||
|
||||
new WC_Twenty_Seventeen();
|
||||
WC_Twenty_Seventeen::init();
|
||||
|
|
|
@ -542,7 +542,6 @@ function get_woocommerce_currency_symbol( $currency = '' ) {
|
|||
'LRD' => '$',
|
||||
'LSL' => 'L',
|
||||
'LYD' => 'ل.د',
|
||||
'MAD' => 'د. م.',
|
||||
'MAD' => 'د.م.',
|
||||
'MDL' => 'MDL',
|
||||
'MGA' => 'Ar',
|
||||
|
|
|
@ -256,7 +256,7 @@ function wc_format_decimal( $number, $dp = false, $trim_zeros = false ) {
|
|||
// Remove locale from string.
|
||||
if ( ! is_float( $number ) ) {
|
||||
$number = wc_clean( str_replace( $decimals, '.', $number ) );
|
||||
$number = preg_replace( '/[^0-9\.,]/', '', $number );
|
||||
$number = preg_replace( '/[^0-9\.,-]/', '', $number );
|
||||
}
|
||||
|
||||
if ( false !== $dp ) {
|
||||
|
|
|
@ -581,7 +581,12 @@ function wc_create_refund( $args = array() ) {
|
|||
do_action( 'woocommerce_order_partially_refunded', $order->get_id(), $refund->get_id() );
|
||||
} else {
|
||||
do_action( 'woocommerce_order_fully_refunded', $order->get_id(), $refund->get_id() );
|
||||
$order->update_status( apply_filters( 'woocommerce_order_fully_refunded_status', 'refunded', $order->get_id(), $refund->get_id() ) );
|
||||
|
||||
$parent_status = apply_filters( 'woocommerce_order_fully_refunded_status', 'refunded', $order->get_id(), $refund->get_id() );
|
||||
|
||||
if ( $parent_status ) {
|
||||
$order->update_status( $parent_status );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ function wc_get_endpoint_url( $endpoint, $value = '', $permalink = '' ) {
|
|||
|
||||
// Map endpoint to options
|
||||
$endpoint = ! empty( WC()->query->query_vars[ $endpoint ] ) ? WC()->query->query_vars[ $endpoint ] : $endpoint;
|
||||
$value = ( 'edit-address' == $endpoint ) ? wc_edit_address_i18n( $value ) : $value;
|
||||
$value = ( get_option( 'woocommerce_myaccount_edit_address_endpoint', 'edit-address' ) === $endpoint ) ? wc_edit_address_i18n( $value ) : $value;
|
||||
|
||||
if ( get_option( 'permalink_structure' ) ) {
|
||||
if ( strstr( $permalink, '?' ) ) {
|
||||
|
|
|
@ -554,10 +554,9 @@ function wc_product_has_unique_sku( $product_id, $sku ) {
|
|||
function wc_product_force_unique_sku( $product_id ) {
|
||||
$product = wc_get_product( $product_id );
|
||||
|
||||
if ( $product ) {
|
||||
if ( $product && ( $current_sku = $product->get_sku( 'edit' ) ) ) {
|
||||
try {
|
||||
$current_sku = $product->get_sku();
|
||||
$new_sku = wc_product_generate_unique_sku( $product_id, $current_sku );
|
||||
$new_sku = wc_product_generate_unique_sku( $product_id, $current_sku );
|
||||
|
||||
if ( $current_sku !== $new_sku ) {
|
||||
$product->set_sku( $new_sku );
|
||||
|
|
|
@ -35,6 +35,7 @@ function wc_update_product_stock( $product, $stock_quantity = null, $operation =
|
|||
delete_transient( 'wc_low_stock_count' );
|
||||
delete_transient( 'wc_outofstock_count' );
|
||||
delete_transient( 'wc_product_children_' . ( $product->is_type( 'variation' ) ? $product->get_parent_id() : $product->get_id() ) );
|
||||
wp_cache_delete( 'product-' . $product_id_with_stock, 'products' );
|
||||
|
||||
// Re-read product data after updating stock, then have stock status calculated and saved.
|
||||
$product_with_stock = wc_get_product( $product_id_with_stock );
|
||||
|
|
|
@ -2474,7 +2474,9 @@ if ( ! function_exists( 'woocommerce_photoswipe' ) ) {
|
|||
*
|
||||
*/
|
||||
function woocommerce_photoswipe() {
|
||||
wc_get_template( 'single-product/photoswipe.php' );
|
||||
if ( current_theme_supports( 'wc-product-gallery-lightbox' ) ) {
|
||||
wc_get_template( 'single-product/photoswipe.php' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -199,7 +199,6 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woocommerce/wo
|
|||
* Select2 has been upgraded to v4.
|
||||
* Improved logging system for extensions.
|
||||
* Tax suffix is now hidden on non-taxable products.
|
||||
* Fix to disallow negative fees.
|
||||
* Performance - Converted rating filters to visibility terms.
|
||||
* Performance - Added visibility term for outofstock products to speed those queries up also.
|
||||
* Performance - Introduced a new CRUD (create, read, update, delete) system for Products, Orders, Customers and Shipping Zones.
|
||||
|
@ -220,7 +219,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woocommerce/wo
|
|||
* Localization - Improved RTL support.
|
||||
* Localization - Added a language independent permalink setting function.
|
||||
* Localization - Added inline comments for placeholder strings.
|
||||
* Localization - Added Nigerian Provinces to i18n/state.
|
||||
* Localization - Added Nigerian and Pakistan Provinces to i18n/state.
|
||||
* Localization - US and Poland postcode validation.
|
||||
|
||||
[See changelog for all versions](https://raw.githubusercontent.com/woocommerce/woocommerce/master/CHANGELOG.txt).
|
||||
|
|
|
@ -43,9 +43,9 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
<?php endforeach; ?>
|
||||
|
||||
<?php do_action( 'woocommerce_after_checkout_billing_form', $checkout ); ?>
|
||||
|
||||
<?php if ( ! is_user_logged_in() && $checkout->is_registration_enabled() ) : ?>
|
||||
|
||||
</div>
|
||||
<?php if ( ! is_user_logged_in() && $checkout->is_registration_enabled() ) : ?>
|
||||
<div class="woocommerce-account-fields">
|
||||
<?php if ( ! $checkout->is_registration_required() ) : ?>
|
||||
|
||||
<p class="form-row form-row-wide create-account">
|
||||
|
@ -62,17 +62,8 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
|
||||
<div class="create-account">
|
||||
|
||||
<p><?php
|
||||
_e( 'Create an account by entering the information below.', 'woocommerce' );
|
||||
if ( 'yes' === get_option( 'woocommerce_enable_checkout_login_reminder' ) ) {
|
||||
echo ' ' . __( 'If you are a returning customer please login at the top of the page.', 'woocommerce' );
|
||||
}
|
||||
?></p>
|
||||
|
||||
<?php foreach ( $checkout->get_checkout_fields( 'account' ) as $key => $field ) : ?>
|
||||
|
||||
<?php woocommerce_form_field( $key, $field, $checkout->get_value( $key ) ); ?>
|
||||
|
||||
<?php endforeach; ?>
|
||||
|
||||
<div class="clear"></div>
|
||||
|
@ -82,6 +73,5 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
<?php endif; ?>
|
||||
|
||||
<?php do_action( 'woocommerce_after_checkout_registration_form', $checkout ); ?>
|
||||
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
|
|
@ -22,7 +22,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html dir="<?php echo is_rtl() ? 'rtl' : 'ltr'?>">
|
||||
<html <?php language_attributes(); ?>>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=<?php bloginfo( 'charset' ); ?>" />
|
||||
<title><?php echo get_bloginfo( 'name', 'display' ); ?></title>
|
||||
|
|
|
@ -334,6 +334,24 @@ class WC_Tests_CRUD_Orders extends WC_Unit_Test_Case {
|
|||
update_option( 'woocommerce_calc_taxes', 'no' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Test mapping from old tax array keys to CRUD functions.
|
||||
*/
|
||||
function test_tax_legacy_arrayaccess() {
|
||||
$tax = new WC_Order_item_Tax();
|
||||
$tax->set_rate_id( 5 );
|
||||
$tax->set_compound( true );
|
||||
$tax->set_tax_total( 2.00 );
|
||||
$tax->set_shipping_tax_total( 1.50 );
|
||||
|
||||
$this->assertEquals( $tax->get_rate_id(), $tax['rate_id'] );
|
||||
$this->assertEquals( $tax->get_compound(), $tax['compound'] );
|
||||
$this->assertEquals( $tax->get_tax_total(), $tax['tax_total'] );
|
||||
$this->assertEquals( $tax->get_tax_total(), $tax['tax_amount'] );
|
||||
$this->assertEquals( $tax->get_shipping_tax_total(), $tax['shipping_tax_total'] );
|
||||
$this->assertEquals( $tax->get_shipping_tax_total(), $tax['shipping_tax_amount'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Test: get_shipping_methods
|
||||
*/
|
||||
|
|
|
@ -145,6 +145,27 @@ class WC_Tests_Product_Functions extends WC_Unit_Test_Case {
|
|||
WC_Helper_Product::delete_product( $product->get_id() );
|
||||
}
|
||||
|
||||
public function test_wc_update_product_stock_increase_decrease() {
|
||||
$product = WC_Helper_Product::create_simple_product();
|
||||
|
||||
update_post_meta( $product->get_id(), '_manage_stock', 'yes' );
|
||||
wc_update_product_stock( $product->get_id(), 5 );
|
||||
|
||||
$new_value = wc_update_product_stock( $product->get_id(), 1, 'increase' );
|
||||
|
||||
$product = new WC_Product_Simple( $product->get_id() );
|
||||
$this->assertEquals( 6, $product->get_stock_quantity() );
|
||||
$this->assertEquals( 6, $new_value );
|
||||
|
||||
$new_value = wc_update_product_stock( $product->get_id(), 1, 'decrease' );
|
||||
|
||||
$product = new WC_Product_Simple( $product->get_id() );
|
||||
$this->assertEquals( 5, $product->get_stock_quantity() );
|
||||
$this->assertEquals( 5, $new_value );
|
||||
|
||||
WC_Helper_Product::delete_product( $product->get_id() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Test wc_delete_product_transients().
|
||||
*
|
||||
|
@ -304,4 +325,37 @@ class WC_Tests_Product_Functions extends WC_Unit_Test_Case {
|
|||
'type' => 'DECIMAL',
|
||||
), $meta_query );
|
||||
}
|
||||
|
||||
/**
|
||||
* Test wc_product_force_unique_sku
|
||||
*
|
||||
* @since 2.7.0
|
||||
*/
|
||||
public function test_wc_product_force_unique_sku() {
|
||||
$product_1 = WC_Helper_Product::create_simple_product();
|
||||
$product_2 = WC_Helper_Product::create_simple_product();
|
||||
$product_3 = WC_Helper_Product::create_simple_product();
|
||||
$product_4 = WC_Helper_Product::create_simple_product();
|
||||
|
||||
$product_1->set_sku( 'some-custom-sku' );
|
||||
$product_2->set_sku( 'another-custom-sku' );
|
||||
$product_3->set_sku( 'another-custom-sku-1' );
|
||||
$product_4->set_sku( '' );
|
||||
|
||||
$product_1_id = $product_1->save();
|
||||
$product_2_id = $product_2->save();
|
||||
$product_3_id = $product_3->save();
|
||||
$product_4_id = $product_4->save();
|
||||
|
||||
wc_product_force_unique_sku( $product_4_id );
|
||||
$this->assertEquals( get_post_meta( $product_4_id, '_sku', true ), '' );
|
||||
|
||||
update_post_meta( $product_4_id, '_sku', 'some-custom-sku' );
|
||||
wc_product_force_unique_sku( $product_4_id );
|
||||
$this->assertEquals( get_post_meta( $product_4_id, '_sku', true ), 'some-custom-sku-1' );
|
||||
|
||||
update_post_meta( $product_4_id, '_sku', 'another-custom-sku' );
|
||||
wc_product_force_unique_sku( $product_4_id );
|
||||
$this->assertEquals( get_post_meta( $product_4_id, '_sku', true ), 'another-custom-sku-2' );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Plugin Name: WooCommerce
|
||||
* Plugin URI: https://woocommerce.com/
|
||||
* Description: An e-commerce toolkit that helps you sell anything. Beautifully.
|
||||
* Version: 2.7.0-beta-3
|
||||
* Version: 2.7.0-beta-4
|
||||
* Author: Automattic
|
||||
* Author URI: https://woocommerce.com
|
||||
* Requires at least: 4.4
|
||||
|
|
Loading…
Reference in New Issue