I don’t think it’s good for seo to have the post at the end of a taxonomy url (duplicate content).
You can change the “Category base” for categories in wp-admin > Settings > Permalinks to “product” to have urls like this:
https://mysite.com/product/category/subcategory/
Or create a custom taxonomy to have urls like this:
https://mysite.com/product/custom-taxonomy/term/childterm/grandchildterm
For this you’ll need to register the taxonomy for your post type “product” in your theme’s functions.php. The taxonomy name can’t be ‘category’ as that is already taken. With the ‘rewrite’ argument you can set it so it produces the hierarchical urls you want:
'rewrite' => array(
'slug' => 'product/type',
'with_front' => true,
'hierarchical' => true ,
),
This example registers a custom taxonomy ‘type’ for your post type ‘product’ (in functions.php):
add_action( 'init', 'type_taxonomy_init' );
function type_taxonomy_init() {
$labels = array(
'name' => _x( 'Types', 'taxonomy general name' ) ,
'singular_name' => _x( 'Type', 'taxonomy singular name' ) ,
'search_items' => __( 'Search Types' ) ,
'all_items' => __( 'All Types' ) ,
'parent_item' => __( 'Parent Type' ) ,
'parent_item_colon' => __( 'Parent Type:' ) ,
'edit_item' => __( 'Edit Type' ) ,
'update_item' => __( 'Update Type' ) ,
'add_new_item' => __( 'Add New Type' ) ,
'new_item_name' => __( 'New Type Name' ) ,
'menu_name' => __( 'Type' ) ,
);
register_taxonomy( 'type', array( 'product' ) ,
array(
'public' => true,
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'query_var' => true,
'rewrite' => array(
'slug' => 'product/type',
'with_front' => true,
'hierarchical' => true ,
),
)
);
}
You probably have to save your permalink structure under wp-admin > Settings > Permalinks for this to work.