Skip to content

Instantly share code, notes, and snippets.

@gcsecsey
Last active September 2, 2023 13:04
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 gcsecsey/98ec6031a6744dc267a0349bb970859f to your computer and use it in GitHub Desktop.
Save gcsecsey/98ec6031a6744dc267a0349bb970859f to your computer and use it in GitHub Desktop.
WooCommerce quick edit schedule product

WooCommerce quick edit schedule product

This small script updates the product date and unsets the private checkbox, scheduling the product for a specific date in the future. I made this because I couldn't find a quicker way to bulk schedule products (none of the WooCommerce bulk product editor plugins support this), but I need to do this for a lot of products at a time as we rotate seasonal products in the shop.

How to use

  • Add snippet.js as a snippet in Chrome dev tools, update the date and time

  • Go to the products list and click on the Quick Edit option

    CleanShot 2023-09-02 at 13 59 42@2x
  • Run the snippet from devtools, it will update these fields and save the product

    CleanShot 2023-09-02 at 13 59 58@2x
// month
document.querySelector(".inline-edit-wrapper .inline-edit-date select[name='mm']").value = "09";
// date
document.querySelector(".inline-edit-wrapper .inline-edit-date input[name='jj']").value = "02";
// year
document.querySelector(".inline-edit-wrapper .inline-edit-date input[name='aa']").value = "2023";
// hour
document.querySelector(".inline-edit-wrapper .inline-edit-date input[name='hh']").value = "18";
// minutes
document.querySelector(".inline-edit-wrapper .inline-edit-date input[name='mn']").value = "00";
// unset private
document.querySelector(".inline-edit-wrapper input[name='keep_private']").value = "";
// click save button
document.querySelector(".inline-edit-wrapper .submit.inline-edit-save button.button-primary.save").click();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment