[WP][WooCommerce] Add SKU next to Variation ID in Admin Metabox
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Add SKU next to variation ID | |
function display_sku_next_to_var_ids() { | |
?> | |
<script type="text/javascript"> | |
jQuery(function($) { | |
"use strict"; | |
$(document).on('woocommerce_variations_loaded', function(event) { | |
var id = -1; | |
$('.woocommerce_variation.wc-metabox').each( function(index, elem) { | |
id++; | |
var var_id = $(elem).find('#variable_sku'+id).val(); | |
$('h3 strong', this).after('<p style="display:inline;"> - SKU: <strong>'+var_id+'</strong></p>'); | |
}); | |
}); | |
}); | |
</script> | |
<?php | |
} | |
add_action( 'admin_print_scripts', 'display_sku_next_to_var_ids', 999); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment