Created
October 28, 2022 15:28
-
-
Save marcusig/8da367e49a7d28e4e89c0eb946e07786 to your computer and use it in GitHub Desktop.
Increase the prices in bulk, in the Bulk price edit screen
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
var factor = 1.05; | |
var round = true; | |
jQuery( '.bulk-choice input.extra-price' ).each( function( ind, item ) { | |
if ( ! jQuery( item ).val() ) return; | |
var value = jQuery( item ).val() * factor; | |
if ( round ) value = Math.round( value ); | |
jQuery( item ).val( value ).trigger( 'change' ); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This code snippet allows to increase all the prices by a given factor.
e.g.
Set the value of
round
tofalse
if you want to keep the float value.