在WooCommerce中有没有下载我的产品的方法或插件?

时间:2016-01-19 作者:Smelly Cat

出于不值得一提的原因,我们的“设计团队”希望恢复到网站的早期版本,但这将意味着丢失我添加或更新的许多产品。有没有办法下载或导出所有这些产品,以便我可以轻松地重新添加它们?

2 个回复
SO网友:Smelly Cat

我可以使用“导出”选项(我不知道)来获得我想要的东西。产品描述是我想要的主要内容,是我已经保存的图像。所以我会在花钱之前看看这是否有效。

SO网友:DoubleMiP

如果您有权访问数据库,只需执行并导出以下查询的结果:

SELECT sku.meta_value AS sku,
       pr.post_title AS title,
       pr.post_content AS description,
       term.name AS category,
       pr.guid AS link,
       img.guid AS image_link
FROM wp_posts pr
INNER JOIN wp_postmeta pm ON pr.ID = pm.post_id
AND pm.meta_key = \'_thumbnail_id\'
INNER JOIN wp_postmeta sku ON pr.ID = sku.post_id
AND sku.meta_key = \'_sku\'
INNER JOIN wp_posts img ON pm.meta_value = img.ID
INNER JOIN wp_term_relationships temr ON pr.ID = temr.object_id
INNER JOIN wp_term_taxonomy temt ON temr.term_taxonomy_id = temt.term_taxonomy_id
AND temt.taxonomy = \'product_cat\'
INNER JOIN wp_terms term ON temt.term_id = term.term_id
WHERE pr.post_type = \'product\';