5th Year Anniversary Super Sale! Save Upto 50% OFF*

Custom Fields to Product page

By Uncategorized

Adding a custom fields with themeforest clone ? Here is an solution for that

To add a “Text Box” field in Add product page, Add following code in product-edit.php template

 

WCVendors_Pro_Form_Helper::textarea( array(
'post_id' => $object_id,
'id' => 'wcv_custom_product_includedfiles',
'label' => __( 'Included Files', 'wcvendors-pro' ),
'placeholder' => __( 'Included Files', 'wcvendors-pro' ),
'desc_tip' => 'true',
'description' => __( ' ', 'wcvendors-pro' ),
) );

 

To add a “Text Area” field in post product page, Add following code in product-edit.php template

 

WCVendors_Pro_Form_Helper::input( array(
'type' => 'text',
'post_id' => $object_id,
'id' => 'wcv_custom_product_includedfiles',
'label' => __( 'Included Files', 'wcvendors-pro' ),
'placeholder' => __( 'Included Files', 'wcvendors-pro' ),
'desc_tip' => 'true',
'description' => __( ' ', 'wcvendors-pro' ),
) );

 

—- Following code will display the values on the single product page. Add this code to your themes buy2themeforest/woocommerce/loop/meta.php file —-


$output = get_post_meta( get_the_ID(), 'wcv_custom_product_includedfiles', true );
// Change wcv_custom_product_includedfiles to your meta key
echo 'Included Files: ' . $output ;

 

Show Buttons
Hide Buttons