Load initial variations when click on variations tab

This commit is contained in:
Claudio Sanches 2015-07-05 20:19:45 -03:00
parent 3d59933d6b
commit b16b026647
3 changed files with 6 additions and 7 deletions

View File

@ -418,7 +418,7 @@ jQuery( function ( $ ) {
});
// Restore ID
$( 'a.add_media' ).on(' click', function () {
$( 'a.add_media' ).on( 'click', function() {
wp.media.model.settings.post.id = wp_media_post_id;
});
@ -431,7 +431,7 @@ jQuery( function ( $ ) {
* Initialize products variations meta box
*/
init: function() {
$( '#load-varitions' ).on( 'click', this.initial_load );
$( 'li.variations_tab a' ).on( 'click', this.initial_load );
},
/**
@ -440,9 +440,9 @@ jQuery( function ( $ ) {
* @return {bool}
*/
initial_load: function() {
wc_meta_boxes_product_variations.load_variations();
return false;
if ( 0 === $( '#variable_product_options_inner .woocommerce_variations .woocommerce_variation' ).length ) {
wc_meta_boxes_product_variations.load_variations();
}
},
/**

File diff suppressed because one or more lines are too long

View File

@ -679,7 +679,6 @@ class WC_Meta_Box_Product_Data {
<a class="button bulk_edit"><?php _e( 'Go', 'woocommerce' ); ?></a>
</p>
<button id="load-varitions">Load Variations</button>
<div class="woocommerce_variations wc-metaboxes" data-attributes="<?php echo esc_attr( json_encode( $attributes ) ); ?>" data-product_id="<?php echo intval( $post->ID ); ?>">
</div>