Skip to content

Instantly share code, notes, and snippets.

@bavington
Created December 15, 2014 20:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bavington/e11d6bc3b50e3c1c0b8c to your computer and use it in GitHub Desktop.
Save bavington/e11d6bc3b50e3c1c0b8c to your computer and use it in GitHub Desktop.
WooCommerce Getting the Regular Price
$regular_price = get_post_meta( get_the_ID(), '_regular_price', true);
if ($regular_price == ""){
$available_variations = $product->get_available_variations();
$variation_id=$available_variations[0]['variation_id'];
$variable_product1= new WC_Product_Variation( $variation_id );
$regular_price = $variable_product1 ->regular_price;
}
echo $regular_price;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment