Skip to content

Instantly share code, notes, and snippets.

@corsonr
Created February 11, 2016 10:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save corsonr/c66fea7c8037555e27b2 to your computer and use it in GitHub Desktop.
Save corsonr/c66fea7c8037555e27b2 to your computer and use it in GitHub Desktop.
WooCommerce 2.5+: add new variations settings
<?php
// Add New Variation Settings
add_filter( 'woocommerce_available_variation', 'load_variation_settings_fields' );
/**
* Add custom fields for variations
*
*/
function load_variation_settings_fields( $variations ) {
// duplicate the line for each field
$variations['text_field'] = get_post_meta( $variations[ 'variation_id' ], '_text_field', true );
return $variations;
}
@volmerf
Copy link

volmerf commented Jun 9, 2016

I added this to my child theme's functions.php but nothing is showing up in my variations setting when I edit a product. Am I missing something? I just updated to WooCommerce 2.5.5 with WP 4.5.2. Any help is much appreciated.

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