WC_Settings_Payment_Gateways::save
Save settings.
Method of the class: WC_Settings_Payment_Gateways{}
Hooks from the method
Returns
null. Nothing (null).
Usage
$WC_Settings_Payment_Gateways = new WC_Settings_Payment_Gateways(); $WC_Settings_Payment_Gateways->save();
WC_Settings_Payment_Gateways::save() WC Settings Payment Gateways::save code WC 10.6.2
public function save() {
global $current_section;
$standardized_section = $this->standardize_section_name( $current_section );
$wc_payment_gateways = WC_Payment_Gateways::instance();
$this->save_settings_for_current_section();
if ( self::MAIN_SECTION_NAME === $standardized_section ) {
// This makes sure 'gateway ordering' is saved.
$wc_payment_gateways->process_admin_options();
$wc_payment_gateways->init();
} else {
// This may be a gateway or some custom section.
foreach ( $wc_payment_gateways->payment_gateways() as $gateway ) {
// If the section is that of a gateway, we need to run the gateway actions and init.
if ( in_array( $standardized_section, array( $gateway->id, sanitize_title( get_class( $gateway ) ) ), true ) ) {
/**
* Fires update actions for payment gateways.
*
* @since 3.4.0
*
* @param int $gateway->id Gateway ID.
*/
do_action( 'woocommerce_update_options_payment_gateways_' . $gateway->id );
$wc_payment_gateways->init();
// There is no need to run the action and gateways init again
// since we can't be on the section page of multiple gateways at once.
break;
}
}
$this->do_update_options_action();
}
}