• Resolved hkandersen

    (@hkandersen)


    Hi,

    I am building a page with several shop-pages, where the products are chosen though shortcodes and categories, like I have been advised earlier here in the support.
    https://docs.woocommerce.com/document/woocommerce-shortcodes/

    But I would also like to filter the products on price and attributes.

    I have tried using the shortcode for the price filter [woocommerce_product_filter_price]:
    https://docs.woocommerce.com/document/woocommerce-product-search/shortcodes/woocommerce_product_filter_price/

    But it doesn’t work on my page. The shortcode is simply written on the page instead of showing a filter: https://www.finddenperfektegave.dk/jul/kalendergaver-til-jul/

    I have tried to look around here on the support topics, and I believe, that it could be because the page is not defined as a shoppage under WooCommerce – Settings – Products.
    But I would like to have several pages with products, and I don’t believe, that I can define more than one shop page?

    Please note, that I am not using a sidebar for the filter. I would like to have the filter on the page.
    Therefore, I believe, that I can only use shortcodes not widgets.

    How can I add filters on the pages when I have several pages?

    Thank you very much
    Best regards
    Henriette

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

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Support Hannah S.L.

    (@fernashes)

    Automattic Happiness Engineer

    Hey there,

    Shortcodes are indeed the best way to determine exactly which products you’d like to show on a page. However, those are then standard pages and not Woo-specific pages like the shop page – so things like the price filter won’t work as it can’t reference the product shortcodes.

    Can you tell me more about what you’d like to set up? Maybe there’s a better option than shortcodes!

    Thread Starter hkandersen

    (@hkandersen)

    Thank you very much for your answer.

    What I would like, is to have several pages with different products on each page.

    And then I would like to have filters on each page – different filters for each specific page.
    That would mean one price filter on each page.
    And also some different attribute filters on each page.

    I hope that makes it clearer. Otherwise please let me know.
    Best regards
    Henriette

    Thread Starter hkandersen

    (@hkandersen)

    Mayby an example makes it easier;
    I am making a website, where you can get inspiration to what gifts to buy.
    Then one page could be for Christmas gifts for children – where you shall be able to sort on price, age and gender.
    One page could be for gifts for women, where you can filter on price and subject (like make up, clothes, books, wellness and so on).

    BR
    Henriette

    Plugin Support Hannah S.L.

    (@fernashes)

    Automattic Happiness Engineer

    Thanks for sharing that!

    What I would like, is to have several pages with different products on each page.

    Then one page could be for Christmas gifts for children – where you shall be able to sort on price, age and gender.

    Those examples were very helpful. 🙂

    So in this case, I’d recommend against shortcodes/blocks, because you’re doing all of the work yourself rather than letting Woo do the heavy lifting for you.

    Instead, I’d recommend using categories, for example:

    * Christmas gifts for children
    * Christmas gifts for women

    When you make a category, Woo will automatically create a dynamic page for you (it doesn’t show up in Pages because it’s dynamically managed by Woo). When customers go to that category page, they’re shown all products in that category – and because it’s a shop page, you’ll have access to all of the standard filters, widgets, etc.

    You can add products to as many categories as you like, so they can show up in multiple places.

    Here’s more info on working with WooCommerce categories:
    https://docs.woocommerce.com/document/managing-product-taxonomies/

    I hope that helps!

    Thread Starter hkandersen

    (@hkandersen)

    Thank you very much
    That is indeed a big help!

    However, I still can’t get the filters to work.

    I have set up a category, that you can see here: https://www.finddenperfektegave.dk/vare-kategori/julekalender-boern/
    But as you can see it doesn’t seem to recognize the shortcodes for the filters. They simply show up as text, instead of as filters.

    I also a few minor other questions to the filters:
    Does the price filter show the word ”price” on the page? Can I translate it to the Danish word “Pris” through the shortcode?
    Is the attribute shortcode using the name or the slug of the attributes?
     The attribute I want to use: ”Kategori julekalender børn”
     The slug of the attribute: “kategori-julekalender-boern”.
    Also is it a problem, that there is a Danish letter “ø” in the attribute name?

    Thank you so very much for your help!

    Plugin Support Hannah S.L.

    (@fernashes)

    Automattic Happiness Engineer

    Hey there,

    Most sites have a very easily solution for adding extra filters: they’d added to the widgets area on the sidebar. Then they show up on all of the different category pages and can be used as needed.

    Here are some examples:
    https://www.businessbloomer.com/woocommerce-product-ajax-filters/

    However, your site doesn’t have a sidebar or other good place to add those widgets, so it makes sense that you’re looking at shortcodes to add the filters.

    Shortcodes will usually only work on pages and posts – areas such as category descriptions tend to be protected. I did some searching to see if I could find a workaround, for example this:
    https://wordpress.stackexchange.com/questions/232411/how-get-a-shortcode-working-in-category-description

    I wasn’t able to get it working in my own test site. This can be due to different code, it can be due to how the theme manages the categories, etc. If this is something you truly need, then your next best step is to work with a developer to help you out. I highly recommend one of the services on our customizations page: https://woocommerce.com/customizations/

    Personally, I’d recommend adding a sidebar and working with widgets – it’ll be easier to work with all around. Your site uses Astra, which has good support for sidebars:
    https://wpastra.com/docs/adding-custom-sidebar/

    I hope that helps you in the right direction!

    Hi @hkandersen,

    We have not heard back from you for a bit, so we will go ahead and close this thread. If you have further questions on this please let us know as it will re-open it, otherwise open a new thread if there are different questions.

    Have a super day!

    Thread Starter hkandersen

    (@hkandersen)

    Sorry, I forgot to answer back.
    Via Google I found another of Hannah S’s replies here, where WooCommerce AJAX Products Filter is mentioned. And that plugin did the trick for me.
    Thank you for all the help

    Plugin Support Hannah S.L.

    (@fernashes)

    Automattic Happiness Engineer

    I’m glad you found a good solution – thanks for letting us know!

    The filters look great. 🙂

    Thread Starter hkandersen

    (@hkandersen)

    Thank you 🙂

    And thank you for all your help. It really was a great help!

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘Price filter does not filter’ is closed to new replies.