Home Forums WC Vendors Pro Support Display values from product custom field in emails

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 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #59287
    Pablo
    Participant

    Hi,

    I was following this tutorial on adding custom field to product submission and successfully implemented a new field-same like this one from the tutorial: https://www.wcvendors.com/kb/adding-a-custom-field-for-products/

    But now I would love to display that custom field field and it’s value on Woocommerce’s order email and order pages.
    Is this possible?

    Thanks

    #59425
    Anna
    Member

    Pablo,
    There are action hooks within the emails templates that you could use… also you can you can modify the email template to show this information.
    The email template you’d need would be: wp content/plugins/wcvendors/templates/emails/vendor-new-order.php

    TO use the action hook– look for one in the email. Such as: woocommerce_email_after_order_table
    SO if we were to use the product ingredients example still, you could use that hook for the add_action like this:

    add_action('woocommerce_email_after_order_table', 'wcv_ingredients_email');
    function wcv_ingredients_email() {
        $output = get_post_meta( get_the_ID(), 'wcv_custom_product_ingredients', true );
        echo 'Ingredients: ' . $output . '<br>';
    }

    Try this– I have not tested it. I think it should work, though. There are other hooks int he email template, such as: woocommerce_email_before_order_table and woocommerce_email_order_meta

    #59736
    Pablo
    Participant

    Hi Anna,
    I’ve tried the code you provided but this only includes “Ingredients: ” in the order email, without a value…
    What could be the issue?

    #61491
    James Pilgrim
    Participant

    @FERVOUS @PAFLY have you found any solution for this issue?

    I’m trying to do the same – retrieving product custom field data to display in the order email tables. All I get from the following code (placed in functions.php) is “Embark On” with no output of the field value.

    
    
    add_action('woocommerce_order_item_meta_start', 'wcv_embarkation_date_email', 5);
    function wcv_embarkation_date_email() {
        $output = get_post_meta( get_the_ID(), 'wcv_custom_product_embarkation_date', true );
        echo 'Embark on ' . $output . '<br>';
    }
    
    
    #61519
    Marko
    Participant

    I have the same problem..

    #61521
    Anna
    Member

    Ok- once I finish with catching up on support requests I will look into this custom code and see if I can get the proper way the value would need to be displayed in the email.

    #61785
    Pablo
    Participant

    Hi Anna,

    Have you had a chance to look this up? Thanks.

    #62277
    brandon
    Participant

    Hi anna, would like to hear about this too.

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