I want to display on a page if the logged in user has ordered a specific product.
I can’t find a function in WC_Order that would allow me to get this information.
I want to display on a page if the logged in user has ordered a specific product.
I can’t find a function in WC_Order that would allow me to get this information.
2
Answers
If you want to check the user has already bought a product then you can use the wc_customer_bought_product function to check that (documentation reference)
The code will look like this:
Full code will look something like this