Skip to content

Instantly share code, notes, and snippets.

@marcusig
Created October 28, 2022 15:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcusig/8da367e49a7d28e4e89c0eb946e07786 to your computer and use it in GitHub Desktop.
Save marcusig/8da367e49a7d28e4e89c0eb946e07786 to your computer and use it in GitHub Desktop.
Increase the prices in bulk, in the Bulk price edit screen
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' );
});
@marcusig
Copy link
Author

This code snippet allows to increase all the prices by a given factor.

e.g.

  • These are the starting prices:

image

  • Copy and paste the code above in the Browser console:

image

  • Press enter to run the code. The prices are updated:

image

Set the value of round to false if you want to keep the float value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment