• Resolved nickw5

    (@nickw5)


    I am trying to set up WooCommerce permalinks to get something like:

    example.com/store/ => Shop page listing products
    example.com/store/category-name/ => Category page listing products from a category
    example.com/store/category-name/product-name/ => Product page showing product details
    But I have a 404 not found error when trying to open the category page.

    What I did is:

    I created a “Shop” page and I set it as the shop page in WooCommerce settings. OK: The page works fine and is displaying all products.

    In WordPress permalinks settings, I set the product category base to “shop”. OK: When I try to display a category page, WP returns a 404 error (but links are properly generated in the shop page sidebar and 404 error occurs while clicking on them).

    In WordPress permalinks settings, I set the product permalink to “/store/%product_cat%”. OK: Products pages are displaying without issue.

    Any way to solve this? https://270.010.godaddywp.com/store

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor Mike Jolley

    (@mikejolley)

    This unfortunately isn’t easy because categories need a custom base so WordPress can distinguish them from post/products etc.

    
    example.com/store/
    example.com/store/category/product
    

    Is fine. But if you do that, you’ll need a unique base for categories. So instead of:

    example.com/store/category/

    Something like:

    example.com/store-category/category

    This will prevent 404s.

    Thread Starter nickw5

    (@nickw5)

    That is not good for SEO though and does not let the user or google know exactly where they are in the store properly, right?

    Is this the only solution? Is that how every other woocommerce store behaves? Seems odd

    Plugin Contributor Mike Jolley

    (@mikejolley)

    Thats the only solution unless you go for custom code and custom rewrite rules. Would not recommend it.

    So long as the terms are in the URL, I don’t see how this would impact your SEO. It’s a link, not a breadcrumb.

    Thread Starter nickw5

    (@nickw5)

    Ok, thank you for your help

    Thread Starter nickw5

    (@nickw5)

    Now I have a ticket category showing on my store front I need hidden. Do you know how to hide a category?
    https://270.010.godaddywp.com/store

    • This reply was modified 7 years, 1 month ago by nickw5.
    Caleb Burks

    (@icaleb)

    Automattic Happiness Engineer

    > Now I have a ticket category showing on my store front I need hidden.

    I’m not seeing it at that link?

    Hiding a specific category will require some customization though.

    Thread Starter nickw5

    (@nickw5)

    I found this, but doesnt seem to work:

    add_filter( ‘get_terms’, ‘organicweb_exclude_category’, 10, 3 );
    function organicweb_exclude_category( $terms, $taxonomies, $args ) {
    $new_terms = array();
    // if a product category and on a page
    if ( in_array( ‘product_cat’, $taxonomies ) && ! is_admin() && ( is_product_category() || is_shop()) ) {
    foreach ( $terms as $key => $term ) {
    // Enter the name of the category you want to exclude in place of ‘uncategorised’
    if ( ! in_array( $term->slug, array( ‘ticket’ ) ) ) {
    $new_terms[] = $term;
    }
    }
    $terms = $new_terms;
    }
    return $terms;
    }

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Permalinks Category Issue’ is closed to new replies.