Skip to content

Instantly share code, notes, and snippets.

@chrisjangl
Created September 17, 2022 12:23
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 chrisjangl/563330800b1721ac3be0e7484923f43a to your computer and use it in GitHub Desktop.
Save chrisjangl/563330800b1721ac3be0e7484923f43a to your computer and use it in GitHub Desktop.
[WP Pizza] Change all ingredients to a specific meal size when on the WP Pizza Ingredients page, Ingredients tab
// set this to the ID of the meal size
var mealSize = "";
// get a node list of all the ingredients on the page
var ingredients = document.querySelectorAll('.wppizza_ingr_option.wppizza_option');
// and then loop through each one, setting the meal size
ingredients.forEach(function(ingredient){
let dropdown = ingredient.querySelector('select.ingredients');
dropdown.value = mealSize;
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment