{"id":4282,"date":"2020-01-10T10:16:35","date_gmt":"2020-01-10T09:16:35","guid":{"rendered":"https:\/\/demos.welaunch.io\/woocommerce-single-variations\/?post_type=faq&#038;p=741"},"modified":"2021-03-17T19:57:58","modified_gmt":"2021-03-17T18:57:58","slug":"add-custom-taxonomies-to-single-variations","status":"publish","type":"faq","link":"https:\/\/www.welaunch.io\/en\/knowledge-base\/faq\/add-custom-taxonomies-to-single-variations\/","title":{"rendered":"Add custom Taxonomies to Single Variations"},"content":{"rendered":"<p>If you want to add custom taxonomies to your product variations, you can use the &#8220;woocommerce_single_variations_taxonomies&#8221; filter. An example how to add the product brand taxonomy can be found here:<\/p>\n<pre>\/**\r\n * Add product_brand to taxonomies list for variations.\r\n *\r\n * @param array $taxonomies\r\n *\r\n * @return array\r\n*\/\r\nadd_filter( 'woocommerce_single_variations_taxonomies', 'add_custom_taxonomies', 10, 1 );\r\nfunction add_custom_taxonomies( $taxonomies ) {\r\n   $taxonomies[] = 'product_brand';\r\n   return $taxonomies;\r\n}\r\n<\/pre>\n<p><strong>After you have placed this function in your child theme functions.php file. Make sure you click on &#8220;init&#8221; in plugin admin settings again.<\/strong><\/p>\n","protected":false},"author":1,"featured_media":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","product_cat":[],"class_list":["post-4282","faq","type-faq","status-publish","hentry","faq_topics-single-variations-filter-hooks","faq_topics-show-single-variations","faq_topics-single-variations-faq"],"_links":{"self":[{"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/faq\/4282","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/faq"}],"about":[{"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/types\/faq"}],"author":[{"embeddable":true,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/comments?post=4282"}],"version-history":[{"count":1,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/faq\/4282\/revisions"}],"predecessor-version":[{"id":5725,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/faq\/4282\/revisions\/5725"}],"wp:attachment":[{"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/media?parent=4282"}],"wp:term":[{"taxonomy":"product_cat","embeddable":true,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/product_cat?post=4282"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}