/** * Persist the user gateway Customer ID for each defined environment, if * the gateway uses Customer ID's * * NOTE: the plugin id, rather than gateway id, is used here, because it's * assumed that in the case of a plugin having multiple gateways (ie credit * card and eCheck) the customer id will be the same between them. * * @since 3.0.0 * @see SV_WC_Payment_Gateway_Admin_User_Edit_Handler::maybe_add_user_profile_customer_id_fields() * @param SV_WC_Payment_Gateway $gateway the gateway instance * @param int $user_id identifies the user to save the settings for */ protected function save_user_profile_customer_id_fields($gateway, $user_id) { $environments = $gateway->get_environments(); // valid environments only foreach (array_keys($environments) as $environment_id) { // update (or blank out) customer id for the given environment if (isset($_POST['_wc_' . $gateway->get_id() . '_customer_id_' . $environment_id])) { $gateway->update_customer_id($user_id, trim($_POST['_wc_' . $gateway->get_id() . '_customer_id_' . $environment_id]), $environment_id); } } }