I have woocommerce integrated with LearnDash. Now I am trying to get the selected course (related course) from the woocommerce product object or any other way (by woocommerce product id). There must be a way as buying the product unlocks the course. Just cannot find it.

Could anyone help?


I have found the answer. It is for anyone who might find it helpful:

get_post_meta(ID, '_related_course', true);

Here ID will be the WooCommerce Product ID. It will output the course id in array. Just need to extract the ID from there.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.