Customising the New Order E-mail to include ticket details

Home Forums Ticket Products Event Tickets Plus Customising the New Order E-mail to include ticket details

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1137149
    James
    Participant

    I’ve decided to scrap the word doc attachments in my previous posts. Instead I want to customise the new order e-mail. I want to add the venue, and some text based on the title/location.

    How can I go about this? I have found a function online which sets text based on the payment method of the order, I wonder if something similar can be done with this, like the order’s venue? I’ve posted this function below.

    add_action( 'woocommerce_email_before_order_table', 'add_order_email_instructions', 10, 2 );
     
    function add_order_email_instructions( $order, $sent_to_admin ) {
      
      if ( ! $sent_to_admin ) {
     
        if ( 'cod' == $order->payment_method ) {
          // cash on delivery method
          echo '<p><strong>Instructions:</strong> Full payment is due immediately upon delivery: <em>cash only, no exceptions</em>.</p>';
        } else {
          // other methods (ie credit card)
          echo '<p><strong>Instructions:</strong> Please look for "Madrigal Electromotive GmbH" on your next credit card statement.</p>';
        }
      }
    }
    #1137267
    George
    Participant

    Hey @James,

    Thanks for reaching out!

    You should indeed be able to make the sort of modifications you describe here. I should note early on that we are unfortunately not able to help with code customizing and such; please read here for more information ? https://theeventscalendar.com/knowledgebase/what-support-is-provided-for-license-holders/

    I just wanted to set your expectations early by mentioning that, but am happy to try and help you get started here!


    The WooCommerce action you shared should indeed be a great start. If you use this along with some The Events Calendar’s template tags, you should be able to add the information you want.

    Those template tags are all found in The Events Calendar plugin files in this folder:

    the-events-calendar/src/functions/template-tags

    Now, despite the policies I mentioned earlier, I’ve gone ahead and just written you a full snippet implementing a basic version of this! 😀

    You can find that here → https://git.io/vK3Yi

    ☝️ This snippet will make the Order Confirmation emails look like this:

    Tinker with it as needed if you want to further refine the display —I hope this helps!

    — George

    #1141500
    FRANK
    Participant

    Hi George,

    This was exactly what I was looking for so I tried it and it almost worked.

    I have different tickets types and therefore this code repeats the event for every ticket type purchased.

    I appreciate this is all above scope of support but was wondering if there was a quick way to ensure that the event title & meta only appears once per event regardless of how many different ticket types are purchased?

    Thanks,

    Frank

    #1141508
    George
    Participant

    Ah! My bad, Frank. To prevent duplicates, I think you can get away by just changing this line of code:


    <?php foreach ( $event_objects as $event_object ) : ?>

    To this:


    <?php

    $event_objects = array_unique( $event_objects );

    foreach ( $event_objects as $event_object ) : ?>

    #1141586
    FRANK
    Participant

    No problem George, problem now solved thanks to your quick advice! Appreciate the help and prompt response.

    #1141694
    George
    Participant

    Sure thing! 😀

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Customising the New Order E-mail to include ticket details’ is closed to new replies.