Home Forums WC Vendors Pro Support Adding a Custom Field for Products

NOTICE: We've Moved to a Ticket System for Support

As of August 31, 2017 (12am EST) our support forums will be retired (read-only), and we will be moving to a support ticket system.  This will allow us to better organize and answer support requests, and provide a more personalized experience as we assist our customers.

For the time being, we will leave our forums open for reading and learning while we work on creating a more robust Knowledge Base for everyone to use.

If you are a WC Vendors Pro customer please open a support ticket here. 

If you are a WC Vendors user please open a support ticket on the Wordpress.org forums.

The information on this forum is outdated and in most instances no longer relevant. Please be sure to check our documentation for the most up to date information.

https://docs.wcvendors.com/

Thank you to all of our customers!

 

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #46127
    Mike
    Participant

    Hi,

    I am playing on a testing web site with WCVendors Pro. One thing I want to do is to tweak the Add Product Form to include several custom fields I need. (By the way, given the price tag I thought WCVendors Pro would include a Form Editor to facilitate this. Will that feature be included in upcoming updates? )

    From the KnowledgeBase, I found the article https://www.wcvendors.com/help/topic/adding-new-fields-to-product-form/ that explains how to do this and I was unsuccessful trying to display the Custom field “Ingredients” on the Product Page.

    What I accomplished…
    The Custom field “Ingredients” appears when I try to Add/Edit a new Product and save the values I provide, so I assume this part of the code works correctly…

    —- The code below goes in your product-edit.php template as outline in the KnowledgeBase Article —-
    <?php
    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’ ),
    ) );
    ?>

    What I could not get to work…
    However, when I click on “View” the Product Page does not display the Custom Field “Ingredients” on the right side of the page after “Categories” and “Tags”. I assume that this part of the code is not working for me

    —- This code will display the vales on the single product page. Add this code to your themes functions.php file —-

    add_action(‘woocommerce_product_meta_start’, ‘wcv_ingredients’, 2);
    function wcv_ingredients() {
    $output = get_post_meta( get_the_ID(), ‘wcv_custom_product_ingredients’, true ); // Change wcv_custom_product_ingredients to your meta key
    echo ‘Ingredients: ‘ . $output . ‘<br>’;
    }

    My questions:

    1. Am I right regarding the functionality of the two pieces of code?
    2. How can I troubleshoot the problem?. I followed the article to the T.
    3. Once I got this right, the Custom Field “Ingredients” will show up on all the pages that make reference to Categories and Tags? or I will have to add manually the same code to different templates

    Thanks for your attention

    #46129
    Marc Bovet
    Participant

    Hi Mike,

    I wrote a complete step by step tutorial.

    HTH,

    marc

    #46215
    Mike
    Participant

    Thanks. Very useful tutorial!.

    Another question. What would it take to define another field such as the categories field or the tags field? The tutorial only uses text fields.

    #46230
    Marc Bovet
    Participant

    Hi Mike,
    no sure to understand what you want to achieve.. do you have some pictures to show ?
    cheers

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘WC Vendors Pro Support’ is closed to new topics and replies.