• I want to add fields at settings of the payment, in order to be able to add other languages.
    I have
    Piraeus Bank POS ID
    I want to add
    Piraeus Bank POS ID - Greek
    Piraeus Bank POS ID - German
    with this code I managed to do it.
    //* Piraeus bank add languages id for other

    add_filter('woocommerce_get_settings_checkout', 'add_custom_piraeus_bank_settings_fields', 10, 2);

    function add_custom_piraeus_bank_settings_fields($settings, $current_section) {

    // Check if we are on the Piraeus Bank settings page

    if ($current_section === 'piraeusbank_gateway') {

    // Define new fields to add

    $new_settings = array(

    array(

    'title' => __('Piraeus Bank POS ID - Greek', 'woo-payment-gateway-for-piraeus-bank'),

    'id' => 'pb_PosId_EL',

    'type' => 'text',

    'desc' => __('Enter your Piraeus Bank POS ID for Greek language.', 'woo-payment-gateway-for-piraeus-bank'),

    'default' => '',

    'desc_tip' => true,

    ),

    array(

    'title' => __('Piraeus Bank POS ID - German', 'woo-payment-gateway-for-piraeus-bank'),

    'id' => 'pb_PosId_DE',

    'type' => 'text',

    'desc' => __('Enter your Piraeus Bank POS ID for German language.', 'woo-payment-gateway-for-piraeus-bank'),

    'default' => '',

    'desc_tip' => true,

    ),

    );

    // Add new fields to the existing settings

    $settings = array_merge($settings, $new_settings);

    }

    return $settings;

    }

    // Save custom fields values

    add_action('woocommerce_update_options_checkout_piraeusbank_gateway', 'save_custom_piraeus_bank_settings_fields');

    function save_custom_piraeus_bank_settings_fields() {

    if (isset($_POST['woocommerce_piraeusbank_gateway_settings'])) {

    $options = array(

    'pb_PosId_EL' => sanitize_text_field($_POST['woocommerce_piraeusbank_gateway_settings']['pb_PosId_EL']),

    'pb_PosId_DE' => sanitize_text_field($_POST['woocommerce_piraeusbank_gateway_settings']['pb_PosId_DE']),

    );

    foreach ($options as $key => $value) {

    update_option($key, $value);

    }

    }

    }
    I want to add fields at settings of the payment, in order to be able to add other languages.
    I have
    Piraeus Bank POS ID
    I want to add
    Piraeus Bank POS ID - Greek
    Piraeus Bank POS ID - German
    with this code I managed to do it.
    //* Piraeus bank add languages id for other

    add_filter('woocommerce_get_settings_checkout', 'add_custom_piraeus_bank_settings_fields', 10, 2);

    function add_custom_piraeus_bank_settings_fields($settings, $current_section) {

    // Check if we are on the Piraeus Bank settings page

    if ($current_section === 'piraeusbank_gateway') {

    // Define new fields to add

    $new_settings = array(

    array(

    'title' => __('Piraeus Bank POS ID - Greek', 'woo-payment-gateway-for-piraeus-bank'),

    'id' => 'pb_PosId_EL',

    'type' => 'text',

    'desc' => __('Enter your Piraeus Bank POS ID for Greek language.', 'woo-payment-gateway-for-piraeus-bank'),

    'default' => '',

    'desc_tip' => true,

    ),

    array(

    'title' => __('Piraeus Bank POS ID - German', 'woo-payment-gateway-for-piraeus-bank'),

    'id' => 'pb_PosId_DE',

    'type' => 'text',

    'desc' => __('Enter your Piraeus Bank POS ID for German language.', 'woo-payment-gateway-for-piraeus-bank'),

    'default' => '',

    'desc_tip' => true,

    ),

    );

    // Add new fields to the existing settings

    $settings = array_merge($settings, $new_settings);

    }

    return $settings;

    }

    // Save custom fields values

    add_action('woocommerce_update_options_checkout_piraeusbank_gateway', 'save_custom_piraeus_bank_settings_fields');

    function save_custom_piraeus_bank_settings_fields() {

    if (isset($_POST['woocommerce_piraeusbank_gateway_settings'])) {

    $options = array(

    'pb_PosId_EL' => sanitize_text_field($_POST['woocommerce_piraeusbank_gateway_settings']['pb_PosId_EL']),

    'pb_PosId_DE' => sanitize_text_field($_POST['woocommerce_piraeusbank_gateway_settings']['pb_PosId_DE']),

    );

    foreach ($options as $key => $value) {

    update_option($key, $value);

    }

    }

    }

    I want to add fields at settings of the payment, in order to be able to add other languages.
    I have
    Piraeus Bank POS ID
    I want to add
    Piraeus Bank POS ID - Greek
    Piraeus Bank POS ID - German
    with this code I managed to do it.
    //* Piraeus bank add languages id for other

    add_filter('woocommerce_get_settings_checkout', 'add_custom_piraeus_bank_settings_fields', 10, 2);

    function add_custom_piraeus_bank_settings_fields($settings, $current_section) {

    // Check if we are on the Piraeus Bank settings page

    if ($current_section === 'piraeusbank_gateway') {

    // Define new fields to add

    $new_settings = array(

    array(

    'title' => __('Piraeus Bank POS ID - Greek', 'woo-payment-gateway-for-piraeus-bank'),

    'id' => 'pb_PosId_EL',

    'type' => 'text',

    'desc' => __('Enter your Piraeus Bank POS ID for Greek language.', 'woo-payment-gateway-for-piraeus-bank'),

    'default' => '',

    'desc_tip' => true,

    ),

    array(

    'title' => __('Piraeus Bank POS ID - German', 'woo-payment-gateway-for-piraeus-bank'),

    'id' => 'pb_PosId_DE',

    'type' => 'text',

    'desc' => __('Enter your Piraeus Bank POS ID for German language.', 'woo-payment-gateway-for-piraeus-bank'),

    'default' => '',

    'desc_tip' => true,

    ),

    );

    // Add new fields to the existing settings

    $settings = array_merge($settings, $new_settings);

    }

    return $settings;

    }

    // Save custom fields values

    add_action('woocommerce_update_options_checkout_piraeusbank_gateway', 'save_custom_piraeus_bank_settings_fields');

    function save_custom_piraeus_bank_settings_fields() {

    if (isset($_POST['woocommerce_piraeusbank_gateway_settings'])) {

    $options = array(

    'pb_PosId_EL' => sanitize_text_field($_POST['woocommerce_piraeusbank_gateway_settings']['pb_PosId_EL']),

    'pb_PosId_DE' => sanitize_text_field($_POST['woocommerce_piraeusbank_gateway_settings']['pb_PosId_DE']),

    );

    foreach ($options as $key => $value) {

    update_option($key, $value);

    }

    }

    }
    I want to add fields at settings of the payment, in order to be able to add other languages.
    I have
    Piraeus Bank POS ID
    I want to add
    Piraeus Bank POS ID - Greek
    Piraeus Bank POS ID - German
    with this code I managed to do it.
    //* Piraeus bank add languages id for other

    add_filter('woocommerce_get_settings_checkout', 'add_custom_piraeus_bank_settings_fields', 10, 2);

    function add_custom_piraeus_bank_settings_fields($settings, $current_section) {

    // Check if we are on the Piraeus Bank settings page

    if ($current_section === 'piraeusbank_gateway') {

    // Define new fields to add

    $new_settings = array(

    array(

    'title' => __('Piraeus Bank POS ID - Greek', 'woo-payment-gateway-for-piraeus-bank'),

    'id' => 'pb_PosId_EL',

    'type' => 'text',

    'desc' => __('Enter your Piraeus Bank POS ID for Greek language.', 'woo-payment-gateway-for-piraeus-bank'),

    'default' => '',

    'desc_tip' => true,

    ),

    array(

    'title' => __('Piraeus Bank POS ID - German', 'woo-payment-gateway-for-piraeus-bank'),

    'id' => 'pb_PosId_DE',

    'type' => 'text',

    'desc' => __('Enter your Piraeus Bank POS ID for German language.', 'woo-payment-gateway-for-piraeus-bank'),

    'default' => '',

    'desc_tip' => true,

    ),

    );

    // Add new fields to the existing settings

    $settings = array_merge($settings, $new_settings);

    }

    return $settings;

    }

    // Save custom fields values

    add_action('woocommerce_update_options_checkout_piraeusbank_gateway', 'save_custom_piraeus_bank_settings_fields');

    function save_custom_piraeus_bank_settings_fields() {

    if (isset($_POST['woocommerce_piraeusbank_gateway_settings'])) {

    $options = array(

    'pb_PosId_EL' => sanitize_text_field($_POST['woocommerce_piraeusbank_gateway_settings']['pb_PosId_EL']),

    'pb_PosId_DE' => sanitize_text_field($_POST['woocommerce_piraeusbank_gateway_settings']['pb_PosId_DE']),

    );

    foreach ($options as $key => $value) {

    update_option($key, $value);

    }

    }

    }
    It works and goes to payment for Greek but if you choose to cancel and return to website, it goes to the English version. mywebsite/checkout, instead to go back to mywebsite/el/checkout
    How can I fix that ?
    any suggestion will be great.
  • You must be logged in to reply to this topic.