• sems09

    (@sems09)


    Hello there,

    What are the possibilities for Woocommerce to do the following?

    I would like to alter the product list of all shop pages(all products page, category pages, subcategory pages,shop page with filter etc..) to filter the products from database for duplicates. Meaning for example if a few products have the same SKU, only one is shown in products list. So for example only the product with lowest price for that particular SKU is showed.

    How can this be done?

    https://wordpress.org/plugins/woocommerce/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Mike Jolley (a11n)

    (@mikejolley)

    Seeing as WooCommerce does not allow duplicate SKUs in the first place, this shouldn’t even be needed.

    Thread Starter sems09

    (@sems09)

    Excuse me then. I gave the ‘SKU’ property as an example. I don’t want to filter duplicate SKU’s but another product property. Is this possible?

    Plugin Author Mike Jolley (a11n)

    (@mikejolley)

    You would need to delve into https://codex.wordpress.org/Class_Reference/WP_Query land, and set query args on the pre_get_posts event. This is complex but possible.

    Thread Starter sems09

    (@sems09)

    You pointed me to the right direction. Thanks a lot.
    I think it should be possible to do. But one more question. Do i have to use a while/for function to read out all results and compare for duplicates, or is there also another option?

    Plugin Author Mike Jolley (a11n)

    (@mikejolley)

    I think you’ll need to pre-query the ones you want and set post__in. I don’t think WP has a function to limit to one term per post.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Filter duplicates’ is closed to new replies.