Skip to content

Instantly share code, notes, and snippets.

@hxii
Created August 26, 2020 12:56
Show Gist options
  • Save hxii/42bcf21990eacb458d7f2b86d7fc0ee4 to your computer and use it in GitHub Desktop.
Save hxii/42bcf21990eacb458d7f2b86d7fc0ee4 to your computer and use it in GitHub Desktop.
Update WooCommerce variation text on change
<?php
// Add from here
function ele_update_sku() {
?>
<script type="text/javascript">
jQuery( document ).ready( function($) {
$( ".single_variation_wrap" ).on( "show_variation", function ( event, variation ) {
$( '#prod-sku' ).text( variation.sku );
});
});
</script>
<?php
}
add_action( 'wp_head', 'ele_update_sku', 10 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment