• henrietteklindt

    (@henrietteklindt)


    Hi there..

    Cross my fingers that you can help me, i′ve tryed Google , Forums ect for more than a week now….

    I createt a big webshop using WordPress/WooCommerce/Booster, and until now it works like a charm. My challenge is:
    I need to have a field/attribute with a comment attached to every product (not the same comment though) ,and it should be hidden on the website.
    This value of field/attribute should be shown a an custom email i created and is being send to a certain reciever everytime there′s a new order – that also works. So for now it′s ‘only’ a matter of how i display the value (i set the value on each product) in this custom email (Booster).
    I created a custom field (it IS showing on each product, and the value IS saved) and added following code in ‘functions.php’ in my childtheme

    <? Php
    add_action (‘woocommerce_product_options_general_product_data’, ‘wc_custom_add_custom_fields’);
    function wc_custom_add_custom_fields () {
    // Print a custom text field
    woocommerce_wp_text_input (array (
    ‘id’ => ‘custom_text_field’,
    ‘label’ => ‘Information for custom email reciever’,
    ‘description’ => ‘This is my custom field.’,
    ‘desc_tip’ => ‘true’,
    ‘placeholder’ => ‘Write my custom note’
    ));
    }
    add_action (‘woocommerce_process_product_meta’, ‘wc_custom_save_custom_fields’);
    function wc_custom_save_custom_fields ($ post_id) {
    if (! empty ($ _POST [‘custom_text_field’])) {
    update_post_meta ($ post_id, ‘custom_text_field’, esc_attr ($ _POST [‘_custom_text_field’]));
    }
    ?? And this is exactly where i can′t make i work – how do i attach this value of ‘custom_text_field’ into my custom email??
    I have tried various wcj column indentifiers without any luck

    My custom email ‘information’ looks like this:

    [wcj_order_items_table
    table_class = “pdf_invoice_items_table”
    columns = “item_quantity | ITEM_NAME | line_total_tax_excl”
    columns_titles = “Quantity | Product | Total”
    (that′s works perfectly)

    UNTIL I TRY TO INSERT SEVERAL (ALL) THE WCJ SHORTCODES AVAILBLE – NO LUCK SO FAR WITH THAT PART

    So to put it short:
    1) I need to display data from custom field in an email, i′m thinking possibly via short code? It should only appear in the custom email I’ve created through the WooCommerce Booster
    AND an extra question
    2) How do i insert data into my custom field from a csv file? I have tried this product-import route, but when I get to select ‘map to field’, the custom field i created does not appear in this drop down list?

    Hope it makes sense and that one of you experts has a solution? or can help me further, or maybe have another solution.
    thanx ?? from someone desperate….. as if in VERY desperate who′s keeping her fingers crossed

    SORRY FOR THIS LONG LONG MAIL I HOPE YOU KNOW WHAT I MEAN

    Regards, and have a nice thursday

    Henriette

    • This topic was modified 7 years ago by henrietteklindt. Reason: spell something wrong and missed some tags
  • The topic ‘Display value of custom field in email’ is closed to new replies.