Allow extensions to hijack i18n_product_type_alert
This commit is contained in:
parent
e2aaafa599
commit
ece4b83562
|
@ -91,10 +91,6 @@ jQuery( function( $ ){
|
|||
// Get value
|
||||
var select_val = $( this ).val();
|
||||
|
||||
if ( 'variable' !== select_val && 0 < $( '#variable_product_options input[name^=variable_sku]' ).length ) {
|
||||
window.alert( woocommerce_admin_meta_boxes.i18n_product_type_alert );
|
||||
}
|
||||
|
||||
if ( 'variable' === select_val ) {
|
||||
$( 'input#_manage_stock' ).change();
|
||||
$( 'input#_downloadable' ).prop( 'checked', false );
|
||||
|
@ -115,6 +111,12 @@ jQuery( function( $ ){
|
|||
|
||||
}).change();
|
||||
|
||||
$( 'body' ).on( 'woocommerce-product-type-change', function( e, select_val ) {
|
||||
if ( 'variable' !== select_val && 0 < $( '#variable_product_options input[name^=variable_sku]' ).length && $( 'body' ).triggerHandler( 'woocommerce-display-product-type-alert', select_val ) !== false ) {
|
||||
window.alert( woocommerce_admin_meta_boxes.i18n_product_type_alert );
|
||||
}
|
||||
});
|
||||
|
||||
$('input#_downloadable, input#_virtual').change(function(){
|
||||
show_and_hide_panels();
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue