Merge pull request #10642 from matheuscl/fixing_product_category_thumbnail_issue

Fix product category thumbnail issue
This commit is contained in:
Mike Jolley 2016-04-07 10:31:52 -05:00
commit db6b6ebb5a
1 changed files with 18 additions and 0 deletions

View File

@ -154,6 +154,24 @@ class WC_Admin_Taxonomies {
return false;
});
jQuery( document ).ajaxComplete( function( event, request, options ) {
if ( request && 4 === request.readyState && 200 === request.status
&& options.data && 0 <= options.data.indexOf( 'action=add-tag' ) ) {
var res = wpAjax.parseAjaxResponse( request.responseXML, 'ajax-response' );
if ( ! res || res.errors ) {
return;
}
// Clear Thumbnail fields on submit
jQuery( '#product_cat_thumbnail' ).find( 'img' ).attr( 'src', '<?php echo esc_js( wc_placeholder_img_src() ); ?>' );
jQuery( '#product_cat_thumbnail_id' ).val( '' );
jQuery( '.remove_image_button' ).hide();
// Clear Display type field on submit
jQuery( '#display_type' ).val( '' );
return;
}
} );
</script>
<div class="clear"></div>
</div>