php - Wordpress plugin - get value of field from setting

213

I am working on a woocommerce plugin extension and i would like to ask how to get value of some field from setting. Like I have checkout page and i would like to make here a list choice and the choices have to be editable.

Here is code which creating fields in setting:

    public static function get_settings() {
    $settings = array(
        'section_title' => array(
            'name'     => __( 'Nastavení událostí, kde převzít (zatím ještě není nefunguje).', 'woocommerce-settings-tab-demo' ),
            'type'     => 'title',
            'desc'     => '',
            'id'       => 'WC_checkout_extension_section_title'
        ),
        'action1' => array(
            'name' => __( 'Akce 1', 'woocommerce-settings-tab-demo' ),
            'type' => 'text',
            'desc' => __( 'Napiš datum a název akce, pro převzetí.', 'woocommerce-settings-tab-demo' ),
            'id'   => 'WC_checkout_extension_action1'
        ),
        'action2' => array(
            'name' => __( 'Akce 2', 'woocommerce-settings-tab-demo' ),
            'type' => 'text',
            'desc' => __( 'Napiš datum a název akce, pro převzetí.', 'woocommerce-settings-tab-demo' ),
            'id'   => 'WC_checkout_extension_action2'
        ),
        'action3' => array(
            'name' => __( 'Akce 3', 'woocommerce-settings-tab-demo' ),
            'type' => 'text',
            'desc' => __( 'Napiš datum a název akce, pro převzetí.', 'woocommerce-settings-tab-demo' ),
            'id'   => 'WC_checkout_extension_action3'
        ),
        'action4' => array(
            'name' => __( 'Akce 4', 'woocommerce-settings-tab-demo' ),
            'type' => 'text',
            'desc' => __( 'Napiš datum a název akce, pro převzetí.', 'woocommerce-settings-tab-demo' ),
            'id'   => 'WC_checkout_extension_action4'
        ),
        'action5' => array(
            'name' => __( 'Akce 5', 'woocommerce-settings-tab-demo' ),
            'type' => 'text',
            'desc' => __( 'Napiš datum a název akce, pro převzetí.', 'woocommerce-settings-tab-demo' ),
            'id'   => 'WC_checkout_extension_action5'
        ),
    );
    return apply_filters( 'WC_checkout_extension_settings', $settings );
}
}
WC_checkout_extension::init();

And i need to get values of this fields into this list:

function kia_filter_checkout_fields($fields){
$fields['extra_fields'] = array(
        'another_field' => array(
            'type' => 'select',
            'options' => array( 'a' => __('Akce 1'), 'b' => __( 'Akce 2' ), 'c' => __( 'Akce 3' ) ),                
            'required'      => false,
            'label' => __( 'Vyber si akci, na které bys chtěl objednávku vyzvednout' )
            )
        );

return $fields;
 }
add_filter( 'woocommerce_checkout_fields', 'kia_filter_checkout_fields');

Thanks for help

People are also looking for solutions to the problem: php - Disable cache ONLY in header

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.