{"id":1563653,"date":"2018-06-28T08:41:56","date_gmt":"2018-06-28T15:41:56","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/event-categories-to-woocommerce-categories-on-ticket-creation\/"},"modified":"2018-06-28T08:41:56","modified_gmt":"2018-06-28T15:41:56","slug":"event-categories-to-woocommerce-categories-on-ticket-creation","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/event-categories-to-woocommerce-categories-on-ticket-creation\/","title":{"rendered":"Event Categories to WooCommerce Categories on Ticket Creation"},"content":{"rendered":"<p>Hi,<\/p>\n<p>I&#8217;ve been trying for the best part of today to do what is usually a very simple thing in WordPress, which your plugin has somehow made incredibly tedious and complicated.<\/p>\n<p>This is what I want to do &#8211; Whenever an event is saved, update the WooCommerce Ticket Product associated with that event to show the same category as the event ID.<\/p>\n<p>I&#8217;ve tried several methods which I&#8217;ll post below:<\/p>\n<pre><code>\/\/on event post save, add categories to all tickets \nfunction ticket_to_product_sync( $post_id ) {\n \n\/\/get categories\n$terms = get_the_terms($post_id, &#039;tribe_events_cat&#039;);\n \n\/\/Get ticket id\n$ticket_id = Tribe__Tickets__Tickets::get_all_event_tickets( $event-&gt;ID );\n\n\/\/add categories to tickets\n    $count = count($terms);\n    if ( $count &gt; 0 ){\n        foreach ( $terms as $term ) {\n                 wp_set_object_terms( $ticket_id , $term-&gt;slug, &#039;product_cat&#039;, true );\n        }\n    }\n}\nadd_action( &#039;save_post&#039;, &#039;ticket_to_product_sync&#039;, 10, 4 );<\/code><\/pre>\n<p>And this:<\/p>\n<pre><code>\/\/ Create WooCommerce Category for ticket\n\nfunction ticket_to_product_sync( $event_id = null, $ticket, $raw_data, $classname ) {\n\n  \/\/ Get the Event Category\n  $term_list = wp_get_post_terms( $event_id, Tribe__Events__Main::TAXONOMY );\n\n\/\/ Apply categories from event ID to ticket when saved\n  foreach( $terms as $term ) {\n    \n      wp_set_object_terms( $ticket_id , $term-&gt;name, &#039;product_cat&#039;, true );\n  }\n\n}\n\nadd_action( &#039;save_post&#039;, &#039;ticket_to_product_sync&#039;, 10, 4 );<\/code><\/pre>\n<p>I understand that applying an event category to a newly created ticket has a workflow issue whereby someone may create a ticket before they apply a category &#8211; But I don&#8217;t care about the event category being added when a ticket is added, I can simply save the event whilst I&#8217;m there once a ticket has been added. Not a big deal.<\/p>\n<p>I&#8217;m at the end of my tether, both with this overly complex method of doing what is in theory an incredible simple task (which I have done with other plugins who correctly utilise WordPress functions) and also reading through all the other support topics with other paying customers asking for the same thing, only to be met with a cookie cutter, copy and paste answer. &#8220;Sorry, but we don&#8217;t provide coded plugin support, you can however check out the list of Known Developers.&#8221; Really?<\/p>\n<p>This should be in the events ticket core plugin, full stop. Why hasn&#8217;t this been added yet?<\/p>\n<p>You might think I&#8217;m being unreasonable here, and I understand whoever is reading this, it probably isn&#8217;t your fault. But do you know how frustrating it is when you&#8217;re trying to solve an issue with zero customer support help, little to no codex references (and the ones that are, seem to be totally wrong or out of date)?!<\/p>\n<p>If you aren&#8217;t going to provide support for this problem among others, you need to provide a solid, in-depth documentation for developers to be able to quickly create their own solutions instead of having to muddle through the intense plugin core files for hours on end. Do you really expect people to learn the entire framework of your plugin to change one small thing?<\/p>\n<p>I look forward to a fully working, coded solution to this. Feel free to mark your response as private if you feel it conflicts with the interests of promoting your &#8216;Known developers&#8217;.<\/p>\n","protected":false},"template":"","class_list":["post-1563653","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>Event Categories to WooCommerce Categories on Ticket Creation -<\/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\/event-categories-to-woocommerce-categories-on-ticket-creation\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Event Categories to WooCommerce Categories on Ticket Creation -\" \/>\n<meta property=\"og:description\" content=\"Hi, I&#8217;ve been trying for the best part of today to do what is usually a very simple thing in WordPress, which your plugin has somehow made incredibly tedious and complicated. This is what I want to do &#8211; Whenever an event is saved, update the WooCommerce Ticket Product associated with that event to show [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/event-categories-to-woocommerce-categories-on-ticket-creation\/\" \/>\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=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/event-categories-to-woocommerce-categories-on-ticket-creation\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/event-categories-to-woocommerce-categories-on-ticket-creation\/\",\"name\":\"Event Categories to WooCommerce Categories on Ticket Creation -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2018-06-28T15:41:56+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/event-categories-to-woocommerce-categories-on-ticket-creation\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/event-categories-to-woocommerce-categories-on-ticket-creation\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/event-categories-to-woocommerce-categories-on-ticket-creation\/#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\":\"Event Categories to WooCommerce Categories on Ticket Creation\"}]},{\"@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":"Event Categories to WooCommerce Categories on Ticket Creation -","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\/event-categories-to-woocommerce-categories-on-ticket-creation\/","og_locale":"en_US","og_type":"article","og_title":"Event Categories to WooCommerce Categories on Ticket Creation -","og_description":"Hi, I&#8217;ve been trying for the best part of today to do what is usually a very simple thing in WordPress, which your plugin has somehow made incredibly tedious and complicated. This is what I want to do &#8211; Whenever an event is saved, update the WooCommerce Ticket Product associated with that event to show [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/event-categories-to-woocommerce-categories-on-ticket-creation\/","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/event-categories-to-woocommerce-categories-on-ticket-creation\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/event-categories-to-woocommerce-categories-on-ticket-creation\/","name":"Event Categories to WooCommerce Categories on Ticket Creation -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2018-06-28T15:41:56+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/event-categories-to-woocommerce-categories-on-ticket-creation\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/event-categories-to-woocommerce-categories-on-ticket-creation\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/event-categories-to-woocommerce-categories-on-ticket-creation\/#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":"Event Categories to WooCommerce Categories on Ticket Creation"}]},{"@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\/1563653","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\/1563653\/revisions"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1563653"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}