尝试在MySQL中查找并批量编辑WooCommerce价格 [英] Trying to locate and bulk edit WooCommerce prices in MySQL

查看:414
本文介绍了尝试在MySQL中查找并批量编辑WooCommerce价格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在WooCommerce版本2.1.12,WordPress版本3.9.1中大约有10,000多种产品,并且由于导入错误,每个产品中的销售价格字段都填充了"0",从而使每个产品现在都免费.

I have roughly 10,000+ products in WooCommerce version 2.1.12, WordPress version 3.9.1 and through an import error, the sale price field was populated with a "0" in every product, thereby making every product now free.

因此,我需要做的当然是删除所有查询,但是我似乎无法找到价格所在的表.

So, what I need to do, of course, is a query to remove all of them, but I just can not seem to find the tables the prices are in.

认为进行了广泛的搜索,试图在Google和此处找到它.我最接近的是这个问题:

I did an extensive search, I think, trying to find this in both Google and here. The closest I came was this question:

需要从mysql数据库中获取产品数据

看起来好像在meta字段中,但是我看不到它们. 有人知道在哪里可以找到价格的细节,也许对查询结构有一点帮助?

which looks as though it's in the meta fields, but I can not visually see them there. Anyone know the specifics of where to find the prices, and maybe a tad bit of help on the query structure?

感谢您的时间,

NE

推荐答案

这是打印价格的方式:

SELECT p.id, p.post_title, m.meta_key, m.meta_value
FROM wp_posts p
INNER JOIN wp_postmeta m ON p.id=m.post_id 
    AND m.meta_key='_price'

您想对价格做什么?更新它们?

What do you want to do with the prices? Update them?

要将价格设置为特定值,这非常简单.设置价格随心所欲.

To set the prices to a specific value, it is quite simple. Set price to whatever you want.

UPDATE wp_postmeta m 
    JOIN wp_posts p ON m.post_id=p.id 
    AND m.meta_key = '_price' 
    AND p.post_type = 'product'
SET m.meta_value = <price>

这篇关于尝试在MySQL中查找并批量编辑WooCommerce价格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆