Created
February 11, 2016 10:49
-
-
Save corsonr/c66fea7c8037555e27b2 to your computer and use it in GitHub Desktop.
WooCommerce 2.5+: add new variations settings
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 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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.