• Resolved SteveHale

    (@stevehale)


    I have a page on the above site called Subscriptions.

    On this page I want to only show two categories in the centre of the page – fiction and non-fiction.

    From the Woocommerce web site I have taken this shortcode:

    [products limit=”8″ columns=”4″ category=”hoodies, tshirts” cat_operator=”AND”] and applied it to my categories:

    [products limit=”8″ columns=”4″ category=”fiction, non-fiction” cat_operator=”AND”]

    However the page shows no categories.

    If however I put:

    [products limit=”8″ columns=”4″ category=”fiction” cat_operator=”AND”]

    The page will show correctly the fiction category.

    What am I doing wrong please?

    Regards

    Steve B

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

Viewing 8 replies - 1 through 8 (of 8 total)
  • Try it without the cat_operator=”AND”

    [products limit=”8″ columns=”4″ category=”fiction, non-fiction”]

    Thread Starter SteveHale

    (@stevehale)

    Hi Sean

    OK that works but then how do I ignore categories to show as it is easier to just exclude 1 or 2 categories than it is to list only the ones to show, especially if there are a lot of them?

    Cheers

    Steve

    Never used it, but I think cat_operator=”NOT IN” should do that.

    Thread Starter SteveHale

    (@stevehale)

    The problem I am having is that I want to show certain categories, not the products from them, on the shop page.

    The default setting on the shop page is to put all the categories. We don’t want that. We have categories like gift vouchers, subscriptions that we want to appear on specific pages, which we can do, BUT we want the same categories NOT to appear on the shop page, or a page we create with a short code.

    We have tried:

    [product_category “fiction”] or [product_category “fiction”] with commas and other category names.

    We have tried:

    [product_categories ids=”21, 59″] – this will only show categories that have items in them but not categories that have no item that will show “0” [zero] – how do we also show categories that do not yet have products in them?

    We have tried this:

    [products limit=”8″ columns=”4″ category=”fiction,non-fiction,subscriptions” cat_operator=”NOT IN”] – what this does is to show the PRODUCTS that are not in the categories but NOT the actual categories.

    Please can someone advise.

    Regards

    Steve B

    Hi there @stevehale ??

    The problem I am having is that I want to show certain categories, not the products from them, on the shop page.

    Thanks for reaching out. Happy to help you with this!

    I suggest going ahead with creating a new page, to use as the shop base, and utilize the “Products by Category” block, instead of shortcodes.

    Here is the block, as it appears in the block inserter. Which then allows for selecting just the categories needed, each time it is inserted. While plenty of block display options are available on the block settings to the right of the screen.

    I trust that points you in the right direction, but if you have more questions, let us know. We’re happy to help.

    Thread Starter SteveHale

    (@stevehale)

    I presume that you presume I am using Gutenberg?

    I am not nor would even go anywhere near it…..

    On that basis I also presume your suggestion would not work?

    Regards

    Steve B

    This enables showing empty categories in the shop page:

    add_filter( ‘woocommerce_product_subcategories_hide_empty’, ‘__return_false’ );

    Not sure if it will affect the shortcode rendering of the categories though

    Hi there @stevehale ??

    I presume that you presume I am using Gutenberg?

    I am not nor would even go anywhere near it…..

    On that basis I also presume your suggestion would not work?

    Presumptions were correct, from both parties, thank you for clarifying.

    The culprit lies with not using straight quotation marks, in the shortcode examples/in-use. Directly linked here is a screenshot verifying that.

    Feel free to check out the troubleshooting shortcodes section, in the documentation, for more on that.

    I trust that points you in the right direction, but if you have more questions, let us know. We’re happy to help.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Showing specific categories on a page’ is closed to new replies.