Created
October 16, 2018 07:03
-
-
Save ville6000/78d5f69f109f3bb74fe369d8852b72f3 to your computer and use it in GitHub Desktop.
How to add fields to WooCommerce products general tab
This file contains hidden or 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 | |
add_action( 'woocommerce_product_options_general_product_data', 'add_my_custom_data' ); | |
public function add_my_custom_data() { | |
global $post; | |
?> | |
<div class="options_group"> | |
<?php | |
woocommerce_wp_text_input( [ | |
'id' => '_my_custom_data_key', | |
'value' => get_post_meta( $post->ID, '_my_custom_data_key', true ), | |
'label' => __( 'My Custom Data', 'my-text-domain' ), | |
'custom_attributes' => [ | |
'disabled' => 'disabled', | |
], | |
] ); | |
?> | |
</div> | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment