admin管理员组文章数量:1333422
I want to make a shop that sells car parts. In order to do so I need additional categories such as make, model, year and so on. The reason why I don't want to put everything in the "categories" section is that I will want to implement a "search by car model" feature, like this:
My worry is that if I put all the information in the "categories" section of the product, then the user will not only see BWM, Audi, etc. but will also see other names of the categories such as "Make" and "Year" in the dropdown menu.
How should I go about solving this problem? For refference, this is my 1st time using wordpress and my experience is not that vast (2nd year of CS)
I want to make a shop that sells car parts. In order to do so I need additional categories such as make, model, year and so on. The reason why I don't want to put everything in the "categories" section is that I will want to implement a "search by car model" feature, like this:
My worry is that if I put all the information in the "categories" section of the product, then the user will not only see BWM, Audi, etc. but will also see other names of the categories such as "Make" and "Year" in the dropdown menu.
How should I go about solving this problem? For refference, this is my 1st time using wordpress and my experience is not that vast (2nd year of CS)
Share Improve this question asked Jul 2, 2020 at 9:04 MantasMantas 133 bronze badges1 Answer
Reset to default 0I presume here that you're using a shopping cart system such as WooCommerce?? If that's the case, you could create new taxonomy terms for the products cut that WooCommerce creates using something like the below:
// Create custom taxonomy for parts CPT
add_action( 'init', 'create_vehmake_taxonomy' );
function create_vehmake_taxonomy() {
register_taxonomy(
'veh-make',
'product', // CPT slug here
array(
'label' => __( 'Vehicle Make' ),
'rewrite' => array( 'slug' => 'make' ), // Tax Term Slug (URL)
'hierarchical' => true,
)
);
}
You could in theory create multiple of these to cater for your needs.
However, for ease of use, I'd probably be more inclined to use the Advanced Custom Fields plugin to create new meta fields on your product CPT that you can then use as select fields or text inputs to populate the data you need on a per-product basis.
本文标签: How can I add more quotfiltersquot to my products (Categoriesattributesetc)
版权声明:本文标题:How can I add more "filters" to my products? (Categories, attributes, etc.) 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742298762a2449254.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论