• Resolved bfalberg

    (@bfalberg)


    Hello!

    I am making a WooCommerce shop using a Block theme, where i want to show both first parent categories, then sub categories and last products. Like i am used to be able to do with the customizer settings of classic themes.

    The Structure i want:

    • Shop page (Showing parent categories)
      • Category page (Showing sub categories) (this is the step i need)
        • Category page (Showing products of the current category)

    How are people approching this in block themes?

    • This topic was modified 2 years ago by bfalberg.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Hey there, @bfalberg! Thanks for contacting us. I’m happy to help you.

    To confirm, as I understand you are using a Full Site Editing theme, is that it? A theme that has the Appearance > Editor option instead of the Customizer?

    If that’s the case, you can set up what is shown on those pages by going to Appearance > Editor > Templates.

    There you will see a section of WooCommerce templates, which you can edit to show the content you want.

    You may use Product Categories List block. There is the following setting that can be used to show sub-categories in “Products by Category” template:

    I hope this was clarifying. Please let us know if there’s anything else we can do to help or if you have any questions.

    Have a wonderful day!

    Thread Starter bfalberg

    (@bfalberg)

    Hmm, does there exist som logic to make the taxonomy product template know if the taxonomy has sub categories to then conditionally show categories or products. Just like in the Classic theme where you under the Customizer can choose what the categori page should show:

    (Sorry for the image with danish translation)

    Otherwize it feels like i need an other template file that doesn’t exist?
    I now use the:
    – archive-product.html
    – taxonomy-product_cat.html

    • This reply was modified 2 years ago by bfalberg.
    Plugin Support Shameem – a11n

    (@shameemreza)

    Hi @bfalberg

    There isn’t a direct way to conditionally show categories or products based on whether a taxonomy has sub-categories. However, you can use a plugin like Conditional Blocks. With this plugin, you can add conditions to your blocks, such as whether a category has sub-categories, and then display different content based on these conditions.

    Alternatively, if you’re comfortable with code, you can create a custom function that checks if a category has sub-categories, and then displays the appropriate content.

    For reference, this particular forum is meant for general support with the core functionality of WooCommerce itself. For development and custom coding questions, it’s best to ask for insight related to those on either the WooCommerce Advanced Facebook group or the WooCommerce Community Slack. Many of our developers hang out there and will be able to offer insights into your question. You can also seek help from the following:

    I wish I could help more, but hopefully, this gets you going in the right direction to get some further insight/information.

    Thread Starter bfalberg

    (@bfalberg)

    Thats perfect! That was the exact answer i was looking for!
    Just to know the possibilities so i dont spend time coding stuff that allready exist. Thanks for the help

    • This reply was modified 2 years ago by bfalberg.
Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Block theme and subcategories’ is closed to new replies.