• Resolved madein83

    (@madein83)


    Hi,

    I’m having trouble setting up a product category structure which suits my website.

    Its a bathroom supply shop and I have multiple category levels for example I have the product category structure;

    Bathrooms > Bathroom Basins > Full Height Pedestal Basins

    And i have products within the lowest category….when customers browse my website that is the navigation experience i want but….

    I would like a single level product category url for ALL categories such as;

    https://www.mywebsite.com/base/lowest-category

    This will be much nicer and more explanatory for SEO

    But I’m currently getting

    https://www.mywebsite.com/base/top-category/middle-category/lowest-category

    The only way i can achieve this currently is to have ALL my categories at the top level…BUT then when people browse to Bathrooms…nothing shows because there are no child categories.

    basically its the same way victoria plumb’s website works that im looking for.

    The nearest i can get is to play with my category slug and get something like;

    https://www.mywebsite.com/bathrooms/basins/full-height which helps more from seo but not from a breadcrumb or visual perspective as my titles will be different to the slug.

    I’ve searched forever and cant find a way to do it….all the plugings that refere to altering permalinks are more for posts and categories not the “product categories”

    Thanks in advance if anyone can help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter madein83

    (@madein83)

    **UPDATE**

    What i didnt know is that it seems woocommerce accepts those urls if they are visited directly i.e. https://www.mywebsite.com/shop/lowest-product-category even though thats not the full structure.

    However my problem remains that when clicking through the generated links are different so what i need is a way to re-write my links manually via the functions file.

    I’ve found a few snippets that apparently work for post categories but not for product categories….i’d imagine its similar but just getting the product category info instead….any ideas.

    Thread Starter madein83

    (@madein83)

    **Fixed**

    Wow….after searching high and low i finally found the snippet i needed….how it wasn’t even marked as an answer i don’t know.

    Remove Parent Categories from URL of custom post type: product – wordpress

    Hopefully this will help someone;

    function wdm_remove_parent_category_from_url( $args ) {
        $args['rewrite']['hierarchical'] = false;
        return $args;
    }
    
    add_filter( 'woocommerce_taxonomy_args_product_cat', 'wdm_remove_parent_category_from_url' );
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘product category url structure’ is closed to new replies.