Skip to content

Instantly share code, notes, and snippets.

Avatar

Basepack basepack

View GitHub Profile
@basepack
basepack / gist:09fdbdd569020e2a0ff1
Last active Nov 6, 2018
WooCommerce : add custom fields to product variations v2.0
View gist:09fdbdd569020e2a0ff1
<?php
//Display Fields
add_action( 'woocommerce_product_after_variable_attributes', 'variable_fields', 10, 3 );
//JS to add fields for new variations
add_action( 'woocommerce_product_after_variable_attributes_js', 'variable_fields_js' );
//Save variation fields
add_action( 'woocommerce_save_product_variation', 'save_variable_fields', 10, 1 );
/**