I have a custom post type called “books”, how can I make “book” buyable through Woocommerce.I have tried the below code which have been mentioned all over the web.i hve edited the post type to book and my meta key is price.

function reigel_woocommerce_get_price($price,$post){

    if ($post->$post->post_type === 'book')
        $price = get_post_meta($post->ID, "price", true);

return $price;

but the code dosent seem to run. The hook is not getting exexcuted rather the “$post” is not bring up the id. it only brings in the products added via products of woocommerce. Am using woocommerce 3.0.7. Any help would be appreciated

is there any workaround fr this method

Read more here: How to add custom post type / post to Woocommerce


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: