If you’re trying to update a field value in phpMyAdmin for the plugin “WooCommerce Product Add-Ons Ultimate” made by Plugin Republic, you might be experiencing the same problem we was, where we were updating it through phpMyAdmin and it wasn’t showing the changes on the live site.
After contacting support we still couldn’t get it to work using their suggestions so we finally figured out after much trial and error that the issue is the values are also stored (cached) in the transient data inside the options table.
Here’s the code my developer used to solve it, I hope this helps you too:
Run This To Create A Table To Backup The Values Before & After Substitution:
CREATE TABLE `wp_newpostmetanew_0601_owl` (
`tempmeta_id` bigint(20) unsigned NOT NULL,
`temppost_id` bigint(20) unsigned NOT NULL DEFAULT '0',
`tempbeforemeta_value` longtext COLLATE utf8mb4_unicode_520_ci,
`tempaftermeta_value` longtext COLLATE utf8mb4_unicode_520_ci,
PRIMARY KEY (`tempmeta_id`),
KEY `temppost_id` (`temppost_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
Then Run This To Populate The Table With The Current Meta Values And The Meta Value After Substitution:
INSERT INTO wp_newpostmetanew_0601_owl
SELECT DISTINCT meta_id, post_id, meta_value, replace(meta_value,
's:8:"Delivery";s:5:"price";s:6:"289.00"',
's:13:"Fast Delivery";s:5:"price";s:6:"399.00"')
from wp_postmeta
where meta_key in ("field_options","all_params")
and meta_value like '%s:8:"Delivery";s:5:"price";s:6:"289.00"%'
and post_id in
(
select config.id
from wp_posts as config
where config.post_type = "pewc_field"
and config.post_parent in
(
select pewc_group.id
from wp_posts as pewc_group
where pewc_group.post_type = "pewc_group"
and pewc_group.post_parent in
(
select product.id
from wp_posts as product
join wp_term_relationships
on object_id = product.id
where term_taxonomy_id IN (17, 53, 23, 35) -- these are your product cats
and product.post_status != "trash"
)
)
);
Then Run This To Replace The Meta Value With The Substitution Value From Your New Table:
UPDATE wp_postmeta SET
meta_value = (SELECT tempaftermeta_value FROM wp_newpostmetanew_0601_owl WHERE meta_id = tempmeta_id)
WHERE meta_id IN (SELECT tempmeta_id FROM wp_newpostmetanew_0601_owl);
Then Run This Delete The Transient Data (cache):
DELETE FROM wp_options WHERE option_name LIKE '%\_transient\_%' and option_value like '%s:8:"Delivery";s:5:"price";s:6:"289.00"%';
Please note:
- There’s multiple SQL queries in the code above, don’t run it all at once, please read the instructions.
- Remember to update the code with your product categories
- Our above code was editing a Checkbox Group, so it’ll likely be a bit different if you’re editing a different field type
- This should put you in the right direction though
- Note that the “S:x” value before the option descriptions should be the number of characters in the description. In the example given above, “Delivery” is 8 characters long, and so it is preceded by “s:8”. “Free Delivery” is 13 characters, and so preceded by “s:13”.