• Resolved clarityonline

    (@reelboldmedia)


    Hello,

    I’m trying to customize the email template to include 2 items:

    1. Customer note (native woocommerce field)
    2. Product image (specifically the variation image used in variable products)

    What function is used to call these elements in the email templates?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author pinal.shah

    (@pinalshah)

    Hi @reelboldmedia,

    You can try using the function $order_obj->get_customer_note(); to get the customer notes.

    Product Image can be fetched using the variation ID. So taking an example of the request-new-quote.php file.

    It contains an existing foreach loop for the order items, where $items is the item object.

    The ID (product or variation) can be fetched using the below code:

    $image_id = isset( $items->get_variation_id() ) && $items->get_variation_id() > 0 ? $items->get_variation_id() : $items->get_product_id();

    The image can then be fetched as below:

    $image = get_the_post_thumbnail( $image_id, $size );

    where $size = array( <width>, <height>, 1)

    I hope this helps.

    Thanks,
    Pinal

    Hello was messing around with the project and this expression causes errors $image_id = isset( $items->get_variation_id() ) && $items->get_variation_id() > 0 ? $items->get_variation_id() : $items->get_product_id();

    The error is Cannot use isset() on the result of an expression (you can use “null !== expression” instead) [duplicate]

    How do we use the expression right before the names of the products on the template file?

    Plugin Author pinal.shah

    (@pinalshah)

    Hi @davidw09,

    In that case, you could possibly try the below:

    $image_id = null !== $items->get_variation_id() && $items->get_variation_id() > 0 ? $items->get_variation_id() : $items->get_product_id();

    Please note that this is untested code.

    Thanks,
    Pinal

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Customizing Emails – Images & order notes’ is closed to new replies.