List out product variation prices in WooCommerce on child sites.
Snippet Type
Execute on Child Sites
Snippet
function list_variation_prices() {
global $product;
if($product->get_type() === 'variable'):
$variations = $product->get_children();
if($variations):
echo '<ul>';
foreach($variations as $variation):
$vproduct = wc_get_product($variation);
echo '<li>'.$vproduct->get_price_html().'</li>';
endforeach;
echo '</ul>';
endif;
endif;
}
/** Change priority to change where you want to show it. Default priorities
* @hooked woocommerce_template_single_title - 5
* @hooked woocommerce_template_single_rating - 10
* @hooked woocommerce_template_single_price - 10
* @hooked woocommerce_template_single_excerpt - 20
* @hooked woocommerce_template_single_add_to_cart - 30
* @hooked woocommerce_template_single_meta - 40
* @hooked woocommerce_template_single_sharing - 50
* @hooked WC_Structured_Data::generate_product_data() - 60
*/
add_action('woocommerce_single_product_summary','list_variation_prices',25);