• Resolved electronicsalm

    (@electronicsalm)


    I am importing thousands of products into an eCommerce site, some products are being imported with 0 stock or product out of stock, because i have imported thousands of products; it’s going to take so much time to manually update stock quantity for each product.

    Using sql, how can i update all products in the database with 0 quantity/out of stock to a preset stock quantity of 100 products ?

    I am using woocommerce 3.2.0

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support RK a11n

    (@riaanknoetze)

    Hi there,

    Instead of writing a complex SQL query, why don’t you simply do a find-replace on the CSV file and then re-upload the file to your WooCommerce installation? That’ll update the data as well ??

    Thread Starter electronicsalm

    (@electronicsalm)

    Hello @riaanknoetze , i know that’s possible but i prefer doing it via sql.

    jessepearson

    (@jessepearson)

    Automattic Happiness Engineer

    Writing custom SQL queries is a bit beyond what we can help with here. However, if you know how to write such queries, the table to look into is wp_postmeta, depending on your db prefix, and the field name for inventory is _stock.

    Please note that this will update the inventory count, but it will not trigger a change in the status from out of stock to in stock. There is a function that is called during product save that changes that status. This is why the csv method was suggested.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘SQL Update product quantity in database woocommerce’ is closed to new replies.