你知道如何在woocommerce设置上创建选择组,我已经创建了它但没有在wocommerce设置上显示
'provinsi' => array(
'name' => __( 'Provinsi', 'woocommerce-settings-tab-cekongkir' ),
'type' => 'select',
'optgroup'=> array(
'1'=>'ridwan'),//opt group
'options' => array(
'1' => 'Bali',
'2' => 'Bangka Belitung',
'3' => 'Banten',
'4' => 'Bengkulu',
'5' => 'DI Yogyakarta',
'6' => 'DKI Jakarta',
'7' => 'Gorontalo',
'8' => 'Jambi',),
'desc_tip' => true,
'id' => 'wc_settings_tab_demo_title_section-1',
'css' => 'min-width:200px'
),
请帮助我。
答案 0 :(得分:0)
使用此过滤器woocommerce_general_settings就像这样
add_filter( 'woocommerce_general_settings', 'provinsi_add_a_setting' );
function provinsi_add_a_setting( $settings ) {
$settings[] = array( 'name' => __( 'Provinsi Custom Settings', 'textdomain' ), 'type' => 'title', 'desc' => '', 'id' => 'woocommerce_provinsi_settings' );
$settings[] = array(
'title' => __( 'Provinsi', 'textdomain' ),
'desc' => '',
'id' => 'woocommerce_provinsi_select_field',
'desc' => __( 'This is a sample text field added', 'textdomain' ),
'type' => 'select',
'options' => array(
'1' => 'Bali',
'2' => 'Bangka Belitung',
'3' => 'Banten',
'4' => 'Bengkulu',
'5' => 'DI Yogyakarta',
'6' => 'DKI Jakarta',
'7' => 'Gorontalo',
'8' => 'Jambi'
),
'default' => '',
'desc_tip' => false,
//'placeholder' => __( 'Placeholder Text', 'textdomain' ),
);
$settings[] = array( 'type' => 'sectionend', 'id' => 'woocommerce_provinsi_settings');
return $settings;
}