Created
November 15, 2018 13:09
-
-
Save jan-koch/5dd8897b974969ed66204e92f6a05ef4 to your computer and use it in GitHub Desktop.
Example of adding a select box to the "General" product data tab.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function prefix_add_selectbox() { | |
$args = array( | |
'id' => 'my_new_select', // required. The meta_key ID for the stored value | |
'wrapper_class' => '', // a custom wrapper class if needed | |
'desc_tip' => true, // makes your description show up with a "?" symbol and as a tooltip | |
'description' => __('My awesome select box', 'your_text_domain'), | |
'label' => __( 'My New Select', 'your_text_domain' ), | |
'options' => array( | |
'value1' => __( 'Text 1', 'your_text_domain' ), | |
'value2' => __( 'Text 2', 'your_text_domain' ) | |
) | |
); | |
woocommerce_wp_select( $args ); | |
} | |
add_action( 'woocommerce_product_options_tax', 'prefix_add_selectbox' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Jan, thanks for this amazing code snippet, is there an option to make the new Field appears in the quick edit page?