I\'m using woocommerce and i created a custom post type that has to be treated as a product and user may add to cart. I followed this tutorial http://reigelgallarde.me/prog
If you already have a meta key which is not _price
, you can add a filter to woocommerce_get_price
shown below.
add_filter('woocommerce_get_price','reigel_woocommerce_get_price',20,2);
function reigel_woocommerce_get_price($price,$post){
if ($post->post->post_type === 'post') // change this to your post type
$price = get_post_meta($post->id, "price", true); // your price meta key is price
return $price;
}