Merge pull request #32828 from woocommerce/fix/32016-shipping-zones-loop
Allow removal of all zone regions from a shipping zone
This commit is contained in:
commit
1e090c3c3c
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: fix
|
||||
|
||||
Allow removal of all zone regions from a shipping zone
|
|
@ -34,11 +34,17 @@
|
|||
this.trigger( 'change:methods' );
|
||||
},
|
||||
save: function() {
|
||||
// Special handling for an empty 'zone_locations' array, which jQuery filters out during $.post().
|
||||
var changes = _.clone( this.changes );
|
||||
if ( _.has( changes, 'zone_locations' ) && _.isEmpty( changes.zone_locations ) ) {
|
||||
changes.zone_locations = [''];
|
||||
}
|
||||
|
||||
$.post(
|
||||
ajaxurl + ( ajaxurl.indexOf( '?' ) > 0 ? '&' : '?' ) + 'action=woocommerce_shipping_zone_methods_save_changes',
|
||||
{
|
||||
wc_shipping_zones_nonce : data.wc_shipping_zones_nonce,
|
||||
changes : this.changes,
|
||||
changes : changes,
|
||||
zone_id : data.zone_id
|
||||
},
|
||||
this.onSaveResponse,
|
||||
|
|
Loading…
Reference in New Issue