• Resolved gomgom42

    (@gomgom42)


    Hello

    I use divi builder to custom my wordpress and woocommerce.

    With shortcode [product_categories parents=0] i can display on my home shop customized page the parents catagories only, all works fine (ie Category a, Category b and Category c)

    Once i click on a category, for exemple Category A the url page is my.website/category-product/category-a

    To customize this kind of page i apply a personalize layout and still use [product_categories]
    But in this category-a page with this shortcode, instead of have child subcategories (ie subcategory-a-1 / subcategory-a-2 / subcategory-a-3) it displays all parents categories, all childs categories (ie subcategory-b-1)

    How can i do to only display subcategores childs on current page ?

    I tried something with success by using a part (line 48 to 81) of archive-product.php but displays was not like a grid

    Thank you for your help

Viewing 9 replies - 1 through 9 (of 9 total)
  • @gomgom42

    Since you’re using Divi to customize the pages, I’d recommend reaching out to their support for further help.

    Thread Starter gomgom42

    (@gomgom42)

    Dear @oaoyadeyi, thank you for your answer but I already did it, and Divi ask me to contact woocommerce support cause problem come from the plugin

    So ?

    • This reply was modified 3 years, 2 months ago by gomgom42.

    Hi there,

    To display subcategories, you can include the category ID inside the parent attribute.

    [product_category category="category-slug-here"]

    For a reference, please check:
    https://woocommerce.com/document/woocommerce-shortcodes/#section-13

    I hope this leads you in the right direction.

    Thread Starter gomgom42

    (@gomgom42)

    Thank you for your answer @ihereira
    I have already read woocommerce shortcode page.

    But with tis solution i need to create a template for each subcategories. And if I have 50 subcategories…

    Does not exist a global solution ?

    Mirko P.

    (@rainfallnixfig)

    Hi @gomgom42,

    The correct shortcode to use is [product_categories parent="0"] and not [product_categories parents=0]. When I use the shortcode on a test page and enter the parent product category I can see all child subcategories.

    Could you please provide us with screenshots so we can check this further?

    I recommend https://snipboard.io for easily sharing screenshots – please follow the instructions on that page, then paste the URL in this thread. It works with Chrome, Firefox, Safari, and Edge browsers.

    Thanks.

    Thread Starter gomgom42

    (@gomgom42)

    Thank you for your answer @rainfallnixfig

    I know for [product_categories parents=0] and i’m using well on my shop home page as you can see below

    https://snipboard.io/3YNoXK.jpg

    Problem come once i click on a category, for exemple “apple”, once i am on apple category products pages,with the shortcode `[product_categories]’ oall parents categories appears and all childs categories appear too as you can see on the second picture

    https://snipboard.io/Vuxy7g.jpg

    So are there a solution using the shortcode [product_categories] to only have child categories on current page (for apple ie iPhone/iPad/apple watch only) ?

    Mirko P.

    (@rainfallnixfig)

    Hi @gomgom42,

    I understand the issue you are having but cannot reproduce it. I’ll post some screenshots below, so you can see that everything is working fine on my test site running with just WooCommerce and the default Storefront theme enabled:

    https://i.imgur.com/sTfDYfm.png
    https://i.imgur.com/5CnbBHO.png
    https://i.imgur.com/eZzD4n4.png
    https://i.imgur.com/cdoTrEC.png
    https://i.imgur.com/LJeayku.png

    The following step would be performing a conflict test to see if the issue is caused by a plugin or theme conflict with WooCommerce.

    Here are the steps for doing a conflict test:

    https://docs.woocommerce.com/document/how-to-test-for-conflicts/

    Just a side note for the shortcode [product_categories parent="0"] about quotation marks – read more here: https://woocommerce.com/document/woocommerce-shortcodes/#section-22.

    Let us know how it goes.

    Thread Starter gomgom42

    (@gomgom42)

    Thank you for you help

    All my parameters are like yours
    [product_categories parent="0"] works well on homepage but as explain on the link you sent me, this code show top level categories but not current page’s child categories

    If i use wordpress theme, there are no problem but with this theme i do not use the shortcode
    Even with Divi if i do not use the code to custom pages, all works fine

    Mirko P.

    (@rainfallnixfig)

    Hi @gomgom42,

    We’re not able to reproduce the behavior you’re describing here:

    Problem come once i click on a category, for exemple “apple”, once i am on apple category products pages,with the shortcode `[product_categories]’ oall parents categories appears and all childs categories appear too as you can see on the second picture

    It looks isolated to your setup. Therefore you may want to try conflict testing to see if the issue is due to a theme or plugin conflict.

    The best way to determine this is to:

    – Temporarily switch your theme to Storefront.
    – Disable all plugins except for WooCommerce.

    Do you still see parent categories when you click on the “Apple” product category?

    If you’re not seeing the same problem after completing the conflict test, then you know the problem was with the plugins and/or theme you deactivated.

    To figure out the cause of the problem, reactivate your theme first and check again. Then activate other plugins one by one, testing after each, until you find the one causing conflict.

    You can find a more detailed explanation on how to do a conflict test here https://docs.woocommerce.com/document/how-to-test-for-conflicts/.

    Let us know how it goes.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘archives category page and [product_categories]’ is closed to new replies.