Today I had to bulk-update the Price and Max Characters in the tab Customizable Options for hundreds of simple products based on the title.
I knew that it could be done programmatically but I figured out that it can be done just by updating the table catalog_product_option and catalog_product_option_price. First I got a comma separated list of option_id’s based on a specific title.
1 |
SELECT GROUP_CONCAT(option_id SEPARATOR ",") AS option_ids FROM catalog_product_option_title WHERE title = 'Some Message'; |
1 |
277,281,284,286,289,292,293,294,295 |
With the comma separated list I was able to update the value of the Price and Max Characters as follows.
1. Price
1 |
UPDATE catalog_product_option_price SET price = 5.000 WHERE option_id IN (277,281,284,286,289,292,293,294,295); |
2. Max Characters
1 |
UPDATE catalog_product_option SET max_characters = 300 WHERE option_id IN (277,281,284,286,289,292,293,294,295); |
Possible that you have to flush the cache ( php/magento cache:flush ) and re-index everything ( php/magento indexer:reindex ) to see the results.