my gateway name is ( Woocommerce_Add_ZarinPal_Gateway )
i want update title this gateway from code
and this my code
$my_options = get_option('woocommerce_WC_ZPal_settings');
$my_options['woocommerce_WC_ZPal_settings']['title'] = 'test';
update_option('woocommerce_WC_ZPal_settings', $my_options);
but when i update gateway other option with same name is update / not update plugin gateway name
my update output :
woocommerce_WC_ZPal_settings";a:2:{s:5:"title";s:4:"test"}
orginal plugin output :
woocommerce_WC_ZPal_settings" string(793) "a:11:{s:11:"base_config";s:0:"";s:7:"enabled";s:3:"yes";s:5:"title";s:35:"پرداخت امن زرین پال";}
note : i have two ((woocommerce_WC_ZPal_settings)) option with same
name ! why?
3
Answers
i found problem , thanks @Pugazhenthi Murugesan .
when i want to update gateway method name from code just must use .
No need to access the woocommerce_WC_ZPal_settings in the my_options array.
You should try to find the specific option name that corresponds to the gateway title you want to update
it should update the gateway title for the specific option that you are targeting.