Skip to content

Instantly share code, notes, and snippets.

Created November 15, 2018 14:54
What would you like to do?
Example for implementing a checkbox as WooCommerce product meta field, in the "General" tab.
function prefix_add_checkbox() {
$args = array(
'label' => '', // Text in the editor label
'class' => '',
'style' => '',
'wrapper_class' => '', // custom CSS class for styling
'value' => '', // meta_value where the id serves as meta_key
'id' => '', // required, it's the meta_key for storing the value (is checked or not)
'name' => '',
'cbvalue' => '', // "value" attribute for the checkbox
'desc_tip' => '', // true or false, show description directly or as tooltip
'custom_attributes' => '', // array of attributes
'description' => '' // provide something useful here
woocommerce_wp_checkbox( $args );
add_action( 'woocommerce_product_options_tax', 'prefix_add_checkbox' );
Copy link

Ist es auch möglich die SKU-Nummer im Backend Admin in der Produktübersicht anzuzeigen?

Copy link

Ja, ist kein Problem. Das kannst du über get_post_meta() laden und dann in der Produkt Admin-Ansicht einbinden. Hier ist ein guter Artikel dazu:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment