Home / Adding a Custom Field for Products (snippet 4)
Duplicate Snippet

Embed Snippet on Your Site

Adding a Custom Field for Products (snippet 4)

This example will output the ingredients text area as the last item on the General Tab

Code Preview
php
<?php
// Output the custom ingredients as the last option on the general tab.
add_action( 'wcv_product_options_general_product_data', 'wcv_product_ingredients' );
function wcv_product_ingredients( $object_id ){
     WCVendors_Pro_Form_Helper::textarea( array(
      'post_id'			=> $object_id,
      'id' 				=> 'wcv_custom_product_ingredients',
      'label' 			=> __( 'Ingredients', 'wcvendors-pro' ),
      'placeholder' 		=> __( 'Ingredients', 'wcvendors-pro' ),
      'desc_tip' 			=> 'true',
      'description' 		=> __( 'The product ingredients', 'wcvendors-pro' ),
    ) );
}

Comments

Add a Comment