{"id":76536,"date":"2013-11-14T15:13:56","date_gmt":"2013-11-14T23:13:56","guid":{"rendered":"http:\/\/tri.be\/support\/forums\/topic\/custom-billing-fields-for-particular-events\/"},"modified":"2013-12-02T14:50:43","modified_gmt":"2013-12-02T22:50:43","slug":"custom-billing-fields-for-particular-events","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-billing-fields-for-particular-events\/","title":{"rendered":"Custom Billing Fields for Particular Events"},"content":{"rendered":"<p>I&#8217;ve had no problem hooking up the Woocommerce Tickets module and inserting my own constant custom checkout fields via this documentation:<br \/>\nhttp:\/\/docs.woothemes.com\/document\/tutorial-customising-checkout-fields-using-actions-and-filters\/<\/p>\n<p>However, I have a few custom checkout fields I&#8217;d like to conditionally add based on the type of event. For example, I&#8217;d like to include a &#8220;Dietary Restrictions&#8221; field for events involving food.<\/p>\n<p>I&#8217;ve concocted one way to maybe do this, but I wanted to see if maybe I was taking the long way around:<br \/>\nAdmin Step 1) Enter an event and a corresponding ticket.<br \/>\nAdmin Step 2) Find that ticket under products and categorize it as &#8220;Includes Food&#8221;.<br \/>\nDeveloper Step 1) In functions.php, add a field &#8220;Dietary Restrictions&#8221; with the class &#8220;food&#8221;.<br \/>\nDeveloper Step 2) In the css, set class &#8220;food&#8221; to display:none.<br \/>\nDeveloper Step 3) On the checkout form (woocommerce\/form-billing), access the Woocommerce cart object to retrieve the product id(s).<br \/>\nDeveloper Step 4) Loop through the product ids, retrieving their Product Categories to see if any are classified as &#8220;Includes Food&#8221;.<br \/>\nDeveloper Step 5) If so, set class &#8220;food&#8221; to display:block.<\/p>\n<p>It seems a little circuitous for both the admin and the developer, and it also modifies a core Woocommerce file, so I&#8217;m hoping someone has a better suggestion. Thanks!<\/p>\n","protected":false},"template":"","class_list":["post-76536","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>Custom Billing Fields for Particular Events -<\/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\/custom-billing-fields-for-particular-events\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Custom Billing Fields for Particular Events -\" \/>\n<meta property=\"og:description\" content=\"I&#8217;ve had no problem hooking up the Woocommerce Tickets module and inserting my own constant custom checkout fields via this documentation: http:\/\/docs.woothemes.com\/document\/tutorial-customising-checkout-fields-using-actions-and-filters\/ However, I have a few custom checkout fields I&#8217;d like to conditionally add based on the type of event. For example, I&#8217;d like to include a &#8220;Dietary Restrictions&#8221; field for events involving food. [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-billing-fields-for-particular-events\/\" \/>\n<meta property=\"article:modified_time\" content=\"2013-12-02T22:50:43+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\/custom-billing-fields-for-particular-events\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-billing-fields-for-particular-events\/\",\"name\":\"Custom Billing Fields for Particular Events -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2013-11-14T23:13:56+00:00\",\"dateModified\":\"2013-12-02T22:50:43+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-billing-fields-for-particular-events\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-billing-fields-for-particular-events\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-billing-fields-for-particular-events\/#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\":\"Custom Billing Fields for Particular Events\"}]},{\"@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":"Custom Billing Fields for Particular Events -","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\/custom-billing-fields-for-particular-events\/","og_locale":"en_US","og_type":"article","og_title":"Custom Billing Fields for Particular Events -","og_description":"I&#8217;ve had no problem hooking up the Woocommerce Tickets module and inserting my own constant custom checkout fields via this documentation: http:\/\/docs.woothemes.com\/document\/tutorial-customising-checkout-fields-using-actions-and-filters\/ However, I have a few custom checkout fields I&#8217;d like to conditionally add based on the type of event. For example, I&#8217;d like to include a &#8220;Dietary Restrictions&#8221; field for events involving food. [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-billing-fields-for-particular-events\/","article_modified_time":"2013-12-02T22:50:43+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\/custom-billing-fields-for-particular-events\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-billing-fields-for-particular-events\/","name":"Custom Billing Fields for Particular Events -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2013-11-14T23:13:56+00:00","dateModified":"2013-12-02T22:50:43+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-billing-fields-for-particular-events\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-billing-fields-for-particular-events\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-billing-fields-for-particular-events\/#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":"Custom Billing Fields for Particular Events"}]},{"@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\/76536","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":0,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/76536\/revisions"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=76536"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}