Ecommerce Shopify WordPress Discussion

How can I create custom taxonomy for WooCommerce without plugin?

I want to create custom taxonomy for WooCommerce. The default taxonomy is category and tag, however, I want more, for example, brands, materials and more. For instance, I want Nike, Adidas... to be under brands; leather, canvas... to be under materials. When I search online, most tutorials are using plugins, like Advanced Custom Fields, to create custom taxonomy for WooCommerce. However, I really don't want to use plugin for just one purpose. I found this online: https://www.wppagebuilders.com/create-custom-taxonomy-without-plugin/ however it is for creating taxonomy for custom post type. I instead want to create custom taxonomy for WooCommerce. Therefore, the code doesn't work for me. add_action('init', 'register_custom_taxonomy'); function register_custom_taxonomy() { $labels = array( 'name' => _x('Collections', 'taxonomy general name'), 'singular_name' => _x('Collection','taxonomy singular name'), 'search_items' => __('Search Collection'), 'all_items' => __('All Collection'), 'parent_item' => __('Parent Collection'), 'parent_item_colon' => __('Parent Collection:'), 'edit_item' => __('Edit Collection'), 'update_item' => __('Update Collection'), 'add_new_item' => __('Add New Collection'), 'new_item_name' => __('New Collection Name'), 'menu_name' => __('Collections'), ); $args = array( 'hierarchical' => true, // make it hierarchical (like categories) 'labels' => $labels, 'show_ui' => true, 'show_admin_column' => true, 'query_var' => true, 'show_in_rest' => true, 'rewrite' => array('slug' => 'Collection'), ); register_taxonomy('Collections', 'wpp_shoe', $args); // Register the Taxonomy } Anybody has solution? Thanks!
To make your custom taxonomy linked to WooCommerce products, Some small adjustments are needed in your code: add_action('init', 'register_custom_taxonomy'); function register_custom_taxonomy() { $labels = array( 'name' => _x('Collection', 'taxonomy general name'), 'singular_name' => _x('Collection', 'taxonomy singular name'), 'search_items' => __('Search Collection'), 'all_items' => __('All Collection'), 'parent_item' => __('Parent Collection'), 'parent_item_colon' => __('Parent Collection:'), 'edit_item' => __('Edit Collection'), 'update_item' => __('Update Collection'), 'add_new_item' => __('Add New Collection'), 'new_item_name' => __('New Collection Name'), 'menu_name' => __('Collections'), ); $args = array( 'labels' => $labels, 'hierarchical' => true, // make it hierarchical (like categories) 'show_ui' => true, 'show_admin_column' => true, 'query_var' => true, 'show_in_rest' => true, 'rewrite' => array('slug' => 'collection'), ); // Register the Taxonomy register_taxonomy('collection', array('product'), $args); }

February 17, 2024

TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.