• Resolved fabiorich

    (@fabiorich)


    Hi everyone,
    I need to filter my products by a value defined via custom attribute.
    Do you happen to know a way to do this?

    Thank you

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Zubair Zahid (woo-hc)

    (@doublezed2)

    Hello fabiorich

    Thank you for contacting WooCommerce support.

    Could you please explain your goal a little bit more?
    Do you want to display products on a page or do you want to list products at the backend?

    Also, share more details about the Custom Attributes.
    How did you create this Custom Attribute?

    With more details, I will be in a better position to assist you further. ??

    Best regards.

    Thread Starter fabiorich

    (@fabiorich)

    first of all thank you very much for the reply.

    My goal on the backend side is to use the wc_get_products function to retrieve products via a custom attribute.

    By custom attributes I mean the fields defined as in the following screenshot: https://ibb.co/6t4gYvD

    Thanks you

    Hi @fabiorich,

    Thanks for getting back to us. To filter products by a custom attribute using the wc_get_products function, you can use the WC_Product_Query class, which provides a standard way of retrieving products that are safe to use and will not break due to database changes in future WooCommerce versions.

    However, to provide a more precise answer, could you please provide more details about the custom attribute you’re using? For example, what is the name of the attribute and what values does it have?

    Once we hear back from you, we’ll be able to help you with this.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Woocommerce: wc_get_products by custom attribute’ is closed to new replies.