Skip to content

Instantly share code, notes, and snippets.

@jan-koch
Created November 15, 2018 14:49
Show Gist options
  • Save jan-koch/d28d02ed4885eb096642501ddcc20235 to your computer and use it in GitHub Desktop.
Save jan-koch/d28d02ed4885eb096642501ddcc20235 to your computer and use it in GitHub Desktop.
Example implementation for a hidden field as WooCommerce product meta field, in the "General" tab.
<?php
function prefix_add_hidden_input() {
$args = array(
'value' => '', // meta_value, meta_key is the id
'class' => '',
'id' => '' // required, makes the meta_key for storing the value
);
woocommerce_wp_hidden_input( $args );
}
add_action( 'woocommerce_product_options_tax', 'prefix_add_hidden_input' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment