Created
May 2, 2015 14:08
-
-
Save karpstrucking/a0803d7a8900a5e10be9 to your computer and use it in GitHub Desktop.
Add ability to apply one WC product variation price to all variations of the same product
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_action( 'woocommerce_product_data_panels', 'gowp_global_variation_price' ); | |
function gowp_global_variation_price() { | |
?> | |
<script type="text/javascript"> | |
jQuery( document ).ready( function() { | |
a = jQuery( '<a href="#">Apply to all Variations</a>' ); | |
b = jQuery( 'input[name^="variable_regular_price"]' ); | |
a.click( function( c ) { | |
d = b.val(); | |
e = confirm( "Change the price of all variations to " + d + "?" ); | |
if ( e ) b.val( d ); | |
c.preventDefault(); | |
} ); | |
b.prev( 'label' ).append( " " ).append( a ); | |
} ); | |
</script> | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment