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 badges
Add a comment  | 

1 Answer 1

Reset to default 0

I 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)