This can never be true:
(strtolower($option->getCode()) == 'info_buyRequest')
In addition, I also had to edit the specific saved user option. My loop looks like this:
foreach ($options as $option) { switch (true) { case (strtolower($option->getCode()) == 'info_buyrequest') : $unserialized = unserialize($option->getValue()); $unserialized['options'][216] = 'NEW VALUE'; $option->setValue(serialize($unserialized)); break; case ($option->getCode() == "option_216") : $option->setValue('NEW VALUE'); break; } }
source share