Stop for change inputs when add a new variation on admin, closes #8874
This commit is contained in:
parent
c6ec8dfd26
commit
b6b34255d2
|
@ -66,10 +66,16 @@ jQuery( function( $ ) {
|
|||
|
||||
/**
|
||||
* Run actions when variations is loaded
|
||||
*
|
||||
* @param {Object} event
|
||||
* @param {Int} needsUpdate
|
||||
*/
|
||||
variations_loaded: function() {
|
||||
variations_loaded: function( event, needsUpdate ) {
|
||||
needsUpdate = needsUpdate || false;
|
||||
|
||||
var wrapper = $( '#woocommerce-product-data' );
|
||||
|
||||
if ( ! needsUpdate ) {
|
||||
// Show/hide downloadable, virtual and stock fields
|
||||
$( 'input.variable_is_downloadable, input.variable_is_virtual, input.variable_manage_stock', wrapper ).change();
|
||||
|
||||
|
@ -89,6 +95,7 @@ jQuery( function( $ ) {
|
|||
|
||||
// Disable cancel and save buttons
|
||||
$( 'button.cancel-variation-changes, button.save-variation-changes', wrapper ).attr( 'disabled', 'disabled' );
|
||||
}
|
||||
|
||||
// Init TipTip
|
||||
$( '#tiptip_holder' ).removeAttr( 'style' );
|
||||
|
@ -119,16 +126,16 @@ jQuery( function( $ ) {
|
|||
});
|
||||
|
||||
// Allow sorting
|
||||
jQuery( '.woocommerce_variations' ).sortable({
|
||||
items : '.woocommerce_variation',
|
||||
cursor : 'move',
|
||||
axis : 'y',
|
||||
handle : '.sort',
|
||||
scrollSensitivity : 40,
|
||||
$( '.woocommerce_variations', wrapper ).sortable({
|
||||
items: '.woocommerce_variation',
|
||||
cursor: 'move',
|
||||
axis: 'y',
|
||||
handle: '.sort',
|
||||
scrollSensitivity: 40,
|
||||
forcePlaceholderSize: true,
|
||||
helper : 'clone',
|
||||
opacity : 0.65,
|
||||
stop : function () {
|
||||
helper: 'clone',
|
||||
opacity: 0.65,
|
||||
stop: function() {
|
||||
wc_meta_boxes_product_variations_actions.variation_row_indexes();
|
||||
}
|
||||
});
|
||||
|
@ -139,12 +146,12 @@ jQuery( function( $ ) {
|
|||
/**
|
||||
* Run actions when added a variation
|
||||
*
|
||||
* @param {Object} event [description]
|
||||
* @param {Object} event
|
||||
* @param {Int} qty
|
||||
*/
|
||||
variation_added: function( event, qty ) {
|
||||
if ( 1 === qty ) {
|
||||
wc_meta_boxes_product_variations_actions.variations_loaded();
|
||||
wc_meta_boxes_product_variations_actions.variations_loaded( null, true );
|
||||
}
|
||||
},
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue