{"id":1116368,"date":"2016-05-19T06:59:06","date_gmt":"2016-05-19T13:59:06","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/send-attachment-based-on-purchased-tickets-locationvenue\/"},"modified":"2016-05-25T08:09:10","modified_gmt":"2016-05-25T15:09:10","slug":"send-attachment-based-on-purchased-tickets-locationvenue","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/send-attachment-based-on-purchased-tickets-locationvenue\/","title":{"rendered":"Send attachment based on purchased ticket&#039;s location\/venue"},"content":{"rendered":"<p>I bought the tickets plugin  and got the free calendar plugin.<\/p>\n<p>I have got the following code in the functions.php file in my theme which sends a word document with the order confirmation e-mail to the client.<\/p>\n<pre><code>\/* attach a word doc with each purchase. Need if statements though. *\/\nfunction attach_doc_to_email ( $attachments , $id, $object ) {\n\t$your_doc_path = get_template_directory() . &#039;\/instructions\/joining-instructions-ahs-chelmsford.docx&#039;;\n\t$attachments[] = $your_doc_path;\n\treturn $attachments;\n}<\/code><\/pre>\n<p>That works fine. But I have a set of 6 documents &#8211; three types of courses (CITB, SSSTS and other) in 2 different locations (colchester and romford). What I want is if the user chooses a CITB course in Colchester, the correct word doc is sent out. Is it possible to add in a few if statements to decide this?<\/p>\n<p>Alternatively can I have the variables for the venue and title please? (Might be able to do a string check on the title for the course type).<\/p>\n","protected":false},"template":"","class_list":["post-1116368","topic","type-topic","status-closed","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Send attachment based on purchased ticket&#039;s location\/venue -<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/send-attachment-based-on-purchased-tickets-locationvenue\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Send attachment based on purchased ticket&#039;s location\/venue -\" \/>\n<meta property=\"og:description\" content=\"I bought the tickets plugin and got the free calendar plugin. I have got the following code in the functions.php file in my theme which sends a word document with the order confirmation e-mail to the client. \/* attach a word doc with each purchase. Need if statements though. *\/ function attach_doc_to_email ( $attachments , [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/send-attachment-based-on-purchased-tickets-locationvenue\/\" \/>\n<meta property=\"article:modified_time\" content=\"2016-05-25T15:09:10+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/send-attachment-based-on-purchased-tickets-locationvenue\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/send-attachment-based-on-purchased-tickets-locationvenue\/\",\"name\":\"Send attachment based on purchased ticket&#039;s location\/venue -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2016-05-19T13:59:06+00:00\",\"dateModified\":\"2016-05-25T15:09:10+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/send-attachment-based-on-purchased-tickets-locationvenue\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/send-attachment-based-on-purchased-tickets-locationvenue\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/send-attachment-based-on-purchased-tickets-locationvenue\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/theeventscalendar.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Topics\",\"item\":\"https:\/\/theeventscalendar.com\/support\/topics\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Ticket Products\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/event-tickets\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Event Tickets Plus\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/event-tickets\/event-tickets-plus\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Send attachment based on purchased ticket&#039;s location\/venue\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\",\"url\":\"https:\/\/theeventscalendar.com\/support\/\",\"name\":\"\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Send attachment based on purchased ticket&#039;s location\/venue -","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/send-attachment-based-on-purchased-tickets-locationvenue\/","og_locale":"en_US","og_type":"article","og_title":"Send attachment based on purchased ticket&#039;s location\/venue -","og_description":"I bought the tickets plugin and got the free calendar plugin. I have got the following code in the functions.php file in my theme which sends a word document with the order confirmation e-mail to the client. \/* attach a word doc with each purchase. Need if statements though. *\/ function attach_doc_to_email ( $attachments , [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/send-attachment-based-on-purchased-tickets-locationvenue\/","article_modified_time":"2016-05-25T15:09:10+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/send-attachment-based-on-purchased-tickets-locationvenue\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/send-attachment-based-on-purchased-tickets-locationvenue\/","name":"Send attachment based on purchased ticket&#039;s location\/venue -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2016-05-19T13:59:06+00:00","dateModified":"2016-05-25T15:09:10+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/send-attachment-based-on-purchased-tickets-locationvenue\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/send-attachment-based-on-purchased-tickets-locationvenue\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/send-attachment-based-on-purchased-tickets-locationvenue\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/theeventscalendar.com\/support\/"},{"@type":"ListItem","position":2,"name":"Topics","item":"https:\/\/theeventscalendar.com\/support\/topics\/"},{"@type":"ListItem","position":3,"name":"Ticket Products","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/event-tickets\/"},{"@type":"ListItem","position":4,"name":"Event Tickets Plus","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/event-tickets\/event-tickets-plus\/"},{"@type":"ListItem","position":5,"name":"Send attachment based on purchased ticket&#039;s location\/venue"}]},{"@type":"WebSite","@id":"https:\/\/theeventscalendar.com\/support\/#website","url":"https:\/\/theeventscalendar.com\/support\/","name":"","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1116368","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":2,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1116368\/revisions"}],"predecessor-version":[{"id":1116682,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1116368\/revisions\/1116682"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1116368"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}