admin管理员组文章数量:1327939
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?
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?
Share Improve this question asked Jul 17, 2020 at 14:06 federicofederico 211 silver badge2 bronze badges 2 |1 Answer
Reset to default 1As 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)
本文标签: databaseWooCommerce sku location in DB
版权声明:本文标题:database - WooCommerce sku location in DB 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742254286a2441342.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
wp_postmeta
, where themeta_key = '_sku'
. If you plan to update data in the store though, you'd be much better served by using the REST API, rather than modifying the data directly: docs.woocommerce/document/woocommerce-rest-api Modifying the database directly means that no WooCommerce code will run for important actions when products are updated. – Jacob Peattie Commented Jul 17, 2020 at 14:19