TransWikia.com

WooCommerce sku location in DB

WordPress Development Asked on October 30, 2021

I need a little help. We want to connect our physical shop system with our virtual shop developed with woocommerce. So we need to be able to find where the SKU numbers are registred in the database so that we can do a batch process a few times a day to modify it as the products are physically sold (and not on the web).

But we haven’t been able to find out where that number is registered in the WP database. Could someone help us?

One Answer

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)

Answered by mozboz on October 30, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP