As suggested in comments, the best way to update stock, or any other product information would be through the WooCommerce API.
The product endpoint with all the parameters is documented here (link is directly to how to update): https://woocommerce.github.io/woocommerce-rest-api-docs/#update-a-product.
I’m not very familiar with woocommerce, but based on other posts it looks like the stock value is stored in the _stock
key in wp_postmeta, see here for more info on that and how to e.g. convert between post ID and SKU if you need to. Again, note that not doing this through the API you might miss out on other code that gets triggered if WooCommerce would usually do other things (e.g. if stock is set to zero maybe it updates other fields automatically or triggers other events if you update through the API)
Related Posts:
- Can’t connect to MySQL server on ‘127.0.0.1’ (10061) (2003)
- phpMyAdmin – Error > Incorrect format parameter?
- Why is my database import losing text widget data?
- Get error messages when $wpdb->insert() returns false?
- Does dbDelta delete columns as well?
- Insert data in database using form
- Special characters in WordPress UTF-8 [closed]
- Long option names fail silently?
- Upload files – total size limit – WordPress/Contact Form 7
- Extend the wp_users table
- Relationship between performance and database size
- I have a problem with my WordPress DB after I tried to install multi-site
- Database sync between local and production
- How to prevent WordPress from retrieving data for the last 10 posts in the database?
- error establishing a database connection
- Get data from database using $WPDB
- Getting all the users who have author privilege
- How to retrieve and show database table in wordpress dashboard
- Moving to another host; which tables to move in a database
- WordPress mysql table double prefixes
- How can I transition a site from using the Beta Tester plugin to a “normal” install?
- SQL Query to Update Admin Email
- Storing data for a wordpress plugin
- Transient feeds and caching error
- get_tags() return an empty array after added tags with wp_insert_term()
- Is it a bad idea to write audit/access/transaction log information directly to the filesystem?
- Why do mass updates to post_content shows in front end, but not in edit screen?
- How to disable (get rid of) home page main loop entirely?
- Insert post in another database
- Sync user meta data to a second database
- Redirecting to old domain after migration website
- WordPress Database Huge wp_usermeta Table
- wp-cli search is returning ‘search’ is not a registered subcommand of ‘db’
- Localhost keeps redirecting to live domain
- How to get membershiplevel from WordPress Database?
- cache specific data?
- wp_insert_post causing There was an error connecting to the database: Access denied for user ‘root’@’localhost’ (using password: NO)
- Child parent relationship inside WP DB
- Copying database tables to new database
- Duplicating Complete WordPress Install for Development and then Redeployment?
- I have a 1300 line excel spreadsheet that needs to get into a wordpress site ASAP – Looking for ideas
- 2 WordPress sites with 2 databases but sharing the same users
- What does wp_term_taxonomy.parent reference?
- How to combine multiple wp_insert_post into one in order to gain better performance
- Insert Query not working in the form
- Two prefixes in database? Which one is valid?
- Enter user registration information in the database
- Problem in using wpdb
- How can I restrict php mail() to only send me one email after a db error
- pull data from a remote wordpress database
- Create database on installation
- Importer fails to import every post
- Users table missing from Database [closed]
- Why does changing Database Table Prefixes result in loss of content?
- Options on how to Display member specific data from a MS SQL database
- How to connect and insert data in database of wordpress?
- Unkown meta_value in ACF
- Buddypress avatar image in database [closed]
- WordPress security [closed]
- wp_option table error while importing
- wp_insert_user not creating account correctly when ID is manually set
- Installing local to live WP into subdirectory
- WordPress SQL – How to Check for Category?
- Getting WordPress to work inside a rails 3 application
- Advantages of dbDelta
- MSQL database wp_postmeta has meta key tve_revision
- Occasional Error Establishing a Database Connection
- Display user data in numbered list
- Removing old_slug and old_date from WordPress Database
- Help with $wpdb on custom code
- “BS_” rows in postmeta table
- How do I change several broken URLs in a several wordpress databases in the fastest way?
- Best way to store 1 billion+ posts?
- Optimize WP site for millions of posts
- I Want a More Concice Form of Data than an Array
- Duplicate database to roll back theme & content changes
- Character encoding issue – black diamond question marks on imported post excerpts
- WordPress Migration – Issue with admin panel changes
- mySQL database size large, but tables size less
- Reinstall wordpress/mySQL caused database problem
- How To connect to the same WordPress database with different database user
- How much post meta data is too much?
- I have include wp-config, should I add global $wpdb also?
- Localize strings from db
- Can’t Install WordPress (local) Failed to open file wp-includes/wp-db.php
- version control for wordpress? (wordpress folder and database at same time)
- How to have WP Search widget index dynamically generated content?
- Preventing concurrent update of data
- Redirect Issue: WordPress database
- Category not displaying in add post, edit post, and categories page.
- Install WordPress with SQL database
- Creating Job Tickets
- Best db table structure for users with many records
- Prevent creation of unused database tables?
- How to store a plain password in WordPress database in another field
- How to stop WordPress from using utf8mb4_unicode_ci collation
- wp_usermeta key problem
- How to properly configure SSL connection to remote azure database for running queries within a WordPress environment
- Database Queries are crashing the server
- Uploading to WordPress Database