• Resolved bvk69varghese

    (@bvk69varghese)


    Hi All,

    I need to list woocommerce products as two sections. All products in my woocommerce are without categories.

    It will be like below.

    1. Products Listing of Woocommerce.

    All products from the woocommerce.

    2. Blogger products.

    These products will be listed just below the above section with a new title as “Blogger Products”.

    Here all products from user_meta product ids related products from woocommerce.

    How can I do this? Please help me to resolve this issue. Thanks in advance.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support Shaun Kuschel a11n

    (@shaunkuschel)

    Automattic Happiness Engineer

    Hey @bvk69varghese,

    Depending on how the site is set up, there are a couple ways to go about this. However, since you aren’t using categories, I’ll explain some ways to achieve this without using categories.

    1. Products Listing of Woocommerce.
    All products from the woocommerce.

    Any page that is set as the “Shop” archive page will show all products in the store by default, but you can use shortcodes to display all products (like [products limit="-1"] for example) or you can use the “All Products” block if you are using Gutenberg blocks.

    2. Blogger products.
    These products will be listed just below the above section with a new title as “Blogger Products”.
    Here all products from user_meta product ids related products from woocommerce.

    I’m not exactly sure how you have this set up currently (or how you plan to set it up if not), but if you are are wanting to show or hide products based on user_meta, this third party article has some info about coding that. However, if that info doesn’t help, please feel free to provide more info about what you are wanting to achieve.

    Thanks!

    Thread Starter bvk69varghese

    (@bvk69varghese)

    Hi All,

    Thank you @shaunkuschel.

    I will explain my requirement in detail.

    In the shop products listing page I need to show two sections.

    1. Normal woocommerce products listing. This is working now. shop home page all products are listing. I need to add a new section with products below these products.

    These products ids I will get it from user meta. If you are using sql we can get the product ids like this. “SELECT post_id FROM “.$wpdb->postmeta.” WHERE meta_key=’is_product_active_blogger_user’ AND meta_value!=’no'”

    I need to list these products just below the woocommerce products listing with a title “Blogger Products”.

    My current woocommerce products listing page is like this.

    Product1 Product2 Product3

    Product4 Product5 Product6

    Product7 Product8 Product9

    But my new requirement I need to change this page layout like below.

    Product1 Product2 Product3

    Product4 Product5 Product6

    Product7 Product8 Product9`

    Blogger Products

    Productx Producty Productz

    Productp Productq Productr

    Products Productt Productu`

    First part is already working. Second part product ids I will get like that. How can show those new products just below that with the “blogger Products” title.

    Hope this explanation will help someone to provide me a solution. Thanks in advance.

    Plugin Support Shaun Kuschel a11n

    (@shaunkuschel)

    Automattic Happiness Engineer

    Hey @bvk69varghese,

    I think I’m following now but how is each product associated to a blogger in the database?

    Thread Starter bvk69varghese

    (@bvk69varghese)

    Thank you @shaunkuschel.

    While adding or editing a product I can assign the product as a blogger product. That time the postid of the post meta table will be saved with the product id and the above queries conditions to be applied. Hope this clarifies.

    At present in my home shop page products are listing without category display. If its a category based display I can add the blogger product as a category and listing it. This is not possible in my case.

    My requirement is in my current shop page product listing(without categories), I need to add one section

    Bloogger Products

    List the products from the above query.

    Any idea, Please reply.Thanks.

    Plugin Support Shaun Kuschel a11n

    (@shaunkuschel)

    Automattic Happiness Engineer

    Hey @bvk69varghese,

    To answer the question about the formatting of the page, you just need to add the code to display the blogger products below the default shop page data. I’d suggest creating a copy of the Shop page template file and customizing it via a child theme. Then, you can reference this article that has a visual hooks guide of that page, do to determine where to put that extra section.

    To actually display the products, I’d recommend using the REST API (docs below), but this thread has some info that might be helpful too.

    https://woocommerce.github.io/woocommerce-rest-api-docs/#introduction

    Plugin Support Tseten a11n

    (@tibetanitech)

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘List two sections of Products listing in Woocommerce’ is closed to new replies.