Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[WordPress][WooCommerce] Add SKU next to Variation ID in Admin Metabox
<?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
You can’t perform that action at this time.