Skip to content

Instantly share code, notes, and snippets.

@fervous
Last active January 6, 2018 10:34
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fervous/ce8059e2144f05b813c5932fbd1d3c6d to your computer and use it in GitHub Desktop.
Save fervous/ce8059e2144f05b813c5932fbd1d3c6d to your computer and use it in GitHub Desktop.
wc vendors pro add new field for product form custom field add edit product
/* child theme functions.php */
add_action( 'wcv_after_product_details', 'wcv_custom_product_condition_field' );
function wcv_custom_product_condition_field () {
WCVendors_Pro_Form_Helper::input( array(
'type' => 'text',
'post_id' => $object_id,
'id' => 'wcv_custom_product_condition',
'label' => __( 'Product Condition', 'wcvendors-pro' ),
'placeholder' => __( 'Please specify if your product is NEW or USED', 'wcvendors-pro' ),
'desc_tip' => 'true',
'description' => __( 'Is your Product New or Used?', 'wcvendors-pro' ),
) );
}
add_action('woocommerce_product_meta_start', 'wcv_product_condition', 2);
function wcv_product_condition() {
$output = get_post_meta(get_the_ID(), 'wcv_custom_product_condition', true );
echo '<p>'.'Product Condition: ' . $output . '</p>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment