批量更改WooCommerce中所有产品的税务状态

huangapple go评论100阅读模式
英文:

Bulk change the tax status from all products in WooCommerce

问题

我正在更改我的业务类型,这将不允许我收取产品税 - 即,所有产品都必须免税。

因此,有超过1200个产品,我如何将状态从“应税”更改为“不应税”?

我已经看到帖子元数据表保存了每个产品的税收状态 - 它们都设置为“应税”,但我没有找到应该设置为“不应税”的值。

我知道我可以更改网站以不收税(我已经这样做了),但我想清理产品定义以保持一切正确。

我只想在数据库上运行以下命令:

update myshop_postmeta set meta_value = "???" where meta_key = "_tax_status"

在将???替换为正确的值后。

请问有人可以指导我正确的方向吗?

英文:

I am changing my business type, which will not permit me to collect tax on products - ie, all products must be without tax.

So, with over 1200 products, how can I change the status from 'taxable' to not taxable ?

I have seen that the posts_meta table holds the tax status for each product - they are all set to "taxable", but I have not been able to find what it should be set to for not taxable.

I know that I can change the site to not charge tax (which I have done), but I want to clean up the product definitions to keep everything correct.

I am wanting to simply run the following command on the database :

update myshop_postmeta set meta_value = "???" where meta_key = "_tax_status"

After having replace the ??? with the right value.

Can anyone point me in the right direction, please ?

答案1

得分: 2

将所有WooCommerce产品的税务状态批量设置为"none",数据库中有2个相关的表需要更新(因此有2个SQL查询):

UPDATE wp_postmeta as pm SET pm.meta_value = 'none' WHERE pm.meta_key = '_tax_status';
UPDATE wp_wc_product_meta_lookup as pml SET pml.tax_status = 'none';

您应该首先检查您的数据库表前缀(默认情况下为wp_)。

在WooCommerce管理产品列表上,您还可以使用"批量操作"来同时编辑多个产品的税务状态。

英文:

To bulk set all WooCommerce products tax status to "none", There are 2 related tables in the database to update (so 2 SQL queries):

<!-- language: lang-sql -->

UPDATE wp_postmeta as pm  SET pm.meta_value = &#39;none&#39;  WHERE pm.meta_key = &#39;_tax_status&#39;;
UPDATE wp_wc_product_meta_lookup as pml SET pml.tax_status = &#39;none&#39;;

> You should first check your database tables prefix (by default it is wp_)

This is tested and perfectly works, using for example PhpMyAdmin.


On WooCommerce Admin Products list, you could also use the "Bulk actions" to edit the tax status of multiple products at once.

批量更改WooCommerce中所有产品的税务状态

批量更改WooCommerce中所有产品的税务状态

huangapple
  • 本文由 发表于 2023年6月11日 23:20:29
  • 转载请务必保留本文链接:https://go.coder-hub.com/76451148.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定