Support » Plugin: WooCommerce » Any way to script some default values for inventory.

  • Resolved xarelix


    I sell unique handcrafted items, so every single Item I list is unique, and obviously a quantity of 1.

    I have to enter manage stock, stock quantity 1, no backorders, and sold individually.

    so the only thing that will EVER change for me on the inventory tab is the SKU, and I am planning to use one of the many automatic SKU addons to handle that.

    I am wondering if anyone knows of an addon that can accomplish this? Or possible a code snippet, I have code snippets installed, and have used it to solve some other things as per google search results.

    I did search google for this answer first, and I would have searched the forums here as well, but the search never completes, it just hangs on “Loading” under both firefox or chromium.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support kellymetal a11n


    Hi there @xarelix!

    There is a guide for setting default stock quantity available here:

    The second snippet applies to simple products, which is what it sounds like you will need (the first one is for variable products).

    It currently only sets the default stock quantity, so you will need to customize it a bit to fit your needs and set the other fields.

    I hope that helps!

    Thank you!

    Thread Starter xarelix


    Hello @kellymetal I gave that script a try, I am guessing it works at one point but no longer does.

    If I enable that snippet, then my add project page does not load, it tries, and just sits at a blank white page.

    To be fair though, that code was originally from 2013 so it would be kinda surprising if it still worked.

    I am still actively trying to figure out a way to accomplish this, please let me know if you or anyone else has any other ideas.

    Thank you 🙂

    Thread Starter xarelix


    Today I found this page:

    That code does not break my page, but it also does not appear to work. will keep trying to figure it out.

    This code is probably the closest I will get to a working example, looks like it was shared this year and hopefully wont need much tweaking.

    • This reply was modified 3 years, 9 months ago by xarelix.
    Thread Starter xarelix


    I just wanted to post that I resolved this, instead of trying to make wooCommerce remember default values in an elegant way.

    GET YOUR HAMMER OUT! LOL! no but seriously. I starting thinking of ways to modify these fields externally.

    What I came up with is using Firefox addon AutoFormer+

    Next click Add a New Product, and adjust only the fields that you want AutoFormer+ to save.

    such as:
    ALSO if you only use one shipping class, such as flat rate, goto the shipping tab and set it.

    Now RIGHT click on one of the Text fields, move your mouse to the AutoFormer+ popup, and select “save all fields”

    TADA! next time your entering products, AutoFormer+ will take care of the monotonous grunt work!

    Plugin Support kellymetal a11n


    Hello @xarelix!!

    I’m so glad to hear that your persistence has paid off! Thank you very much for sharing your solution here. I think that will come in handy for other community members.

    I’m sorry about the delay, as I was away for a few days. Also, about the no-longer-working snippet from 2013!

    Anyway, I’m very glad to hear you got everything working here!! : )

    Have a wonderful day!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Any way to script some default values for inventory.’ is closed to new replies.