Pour mettre à jour _regular_price
UPDATE
`wp_postmeta`
SET
`meta_value` = ROUND(`meta_value` * 1.40, 2)
WHERE
meta_key = '_regular_price'
AND `post_id` IN (
SELECT
`object_id` AS product_id
FROM
`wp_term_relationships`
WHERE
term_taxonomy_id = 376
AND `object_id` IN (
SELECT
`ID`
FROM
`wp_posts`
WHERE
`post_type` = 'product'
AND `post_status` = 'publish'
AND `ID` = `object_id`
)
);
Pour mettre à jour _price
UPDATE
`wp_postmeta`
SET
`meta_value` = ROUND(`meta_value` * 1.40, 2)
WHERE
meta_key = '_price'
AND `post_id` IN (
SELECT
`object_id` AS product_id
FROM
`wp_term_relationships`
WHERE
term_taxonomy_id = 376
AND `object_id` IN (
SELECT
`ID`
FROM
`wp_posts`
WHERE
`post_type` = 'product'
AND `post_status` = 'publish'
AND `ID` = `object_id`
)
);
Vous devez également supprimer la mise en cache du prix des produits WooCommerce qui est stockée dans la table wp_options
sous _transient_timeout_wc_var_prices_{{post_id}}
et _transient_wc_var_prices_{{post_id}}
dansoption_name
DELETE
FROM `wp_options`
WHERE (`option_name` LIKE '_transient_wc_var_prices_%'
OR `option_name` LIKE '_transient_timeout_wc_var_prices_%')
La requête est testé et a travaillé pour moi, et avant d’exécuter cette requête, prenez une sauvegarde de base de données.
J’espère que cela vous aide 🙂