ACF display in email template

Home Forums Ticket Products Event Tickets Plus ACF display in email template

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1152046
    Orla
    Participant

    Is it possible to display Advanced Custom Fields in the Events Tickets Plus template?

    My ACF field url is ‘webinar_link’

    I copied the template from the Events Tickets plugin to my Child Theme correctly and am able to add HTML to verify that the new template is working. However, when I add this snippet from ACF to display the webinar_link nothing appears:

    <?php if( get_field(‘webinarLink’) ): ?>

    ” >Register with gotoWebinar!

    <?php endif; ?>

    The point of what I am trying to achieve is a link that is only shown after the customer has purchased or RSVP’d for the event first on the website. The link changes for each event. Ideally I would like the link to show in the Ticket email as detailed above and also on the woo-commerce Thank You page. I’ve tried to add it to both but neither works (I can add html so the template locations in my child theme are correct).

    Is this possible to do?

    Many thanks,
    Orla

    #1152062
    Geoff
    Member

    Hi Orla, thanks for getting in touch!

    Great question and the answer is yes — it is definitely possible to add an ACF field to the email template. I just tested it out and was able to get it in there with this:

    <?php
    if(get_field('webinarLink')) {
    echo '<a href="' . get_field('webinarLink') . '">Register Now!</a>';
    }
    ?>

    It’s worth noting that you will need to place that code where you would like the link to appear in the template. 🙂

    Will this work for you? Please let me know.

    Cheers!
    Geoff

    #1152490
    Orla
    Participant

    Hi Geoff,

    Thank you for your reply – it is really appreciated. This is still not working for me. I am inserting it into the woocommerce/templates/checkout/thank-you.php page as that is easier to test than the emails.

    I also added the title

    Details

    outside the if statement to test that I am editing the correct template – which I am. However, the if statement is not running. Even when I just run:
    echo '<a href="' . get_field('webinarLink') . '">Register Now!</a>';
    it is still not giving any results.

    The ACF type is a URL and correctly displays on any post taxonomy ‘Webinars’. I have just sent a support request to ACF too to see if there is something I am missing or a known issue as it just doesn’t make sense.

    Even: echo the_field('webinarLink'); doesn’t work.

    I will update this as soon as I have gotten a response from them.

    #1152559
    Geoff
    Member

    Oh shoot, sorry for the continued trouble here!

    I’ll definitely keep this thread open while you await support with ACF — do note that our system automatically closes threads after three weeks of inactivity, but I don’t think that will be an issue. 🙂

    If it helps, I can confirm that I was testing the following:

    • Created a new ACF group
    • Create a new URL field called webinarLink and attached the field to the Events post type
    • Created a new event post, including a link added to the webinarLink ACF field
    • Added the snippet of code I provided in my first reply to the following template: /plugins/event-tickets/src/views/event-tickets/tickets/email.php
    • Made a test purchase of a ticket
    • Received the email confirmation, which included a link to “Register Now!” (screenshot)

    I hope this helps!

    Geoff

    #1161539
    Support Droid
    Keymaster

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘ACF display in email template’ is closed to new replies.