• Resolved alberto3

    (@alberto3)


    Hi. Is there a way to exclude products based on ID, from the shortcode [products]?

    Something like [products ids=”123″ ids_operator=”NOT IN”]

    I need it because I am showing the shortcode on the single product page, but the main product is repeated in the listing.

    Thank you very much.

Viewing 3 replies - 1 through 3 (of 3 total)
  • See:
    https://woocommerce.com/document/woocommerce-shortcodes/

    So it looks like the answer is no, but what you could do is use the “NOT IN” operator if you can use terms, tags or categorys to identify the unwanted products.

    If you’re into coding, there’s a filter you could use: “woocommerce_shortcode_products_query_results”. Your filter function would cycle through the returned results and could filter out the current product. The code for that is perhaps beyond what might be expected in a forum answer.

    Hi @alberto3

    By default, there is no option, it required a good deal of customization, as @lorro mentioned above.

    Please keep in mind, customizations and custom code like this falls outside the scope of our?Support Policy?and we’re unable to assist with it.

    If you need help with development or customizations, I recommend taking a look at the services offered on our WooExperts page:?https://woocommerce.com/experts/

    I can also recommend the WooCommerce Developer Resources Portal for resources on developing for WooCommerce.

    You can also visit the WooCommerce Facebook group or the #developers channel of the WooCommerce Community Slack. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there, as well.

    I hope this helps you in the right direction!

    Thread Starter alberto3

    (@alberto3)

    Thanks to both of you, I’ll do some research about woocommerce_shortcode_products_query_results

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Exclude product IDs from shortcode [products]’ is closed to new replies.