About this:

Adding this to your functions.php will update the price label with the variation price.

Step 1: Adding the Function

This function should be added into the functions.php. You can often find this under Appearance > Theme editor. Be sure to select the Flatsome Child so it does not get deleted with a new update.

If you don’t have a child theme, you can find how to install it here: How to install Flatsome Child theme?

// Update Price label on price select
add_action( 'woocommerce_variable_add_to_cart', 'update_price_with_variation_price' );
function update_price_with_variation_price() {
   global $product;
   $price = $product->get_price_html();
   wc_enqueue_js( "     
      $(document).on('found_variation', 'form.cart', function( event, variation ) {   
         if(variation.price_html) $('p.price').html(variation.price_html);
         $('.woocommerce-variation-price').hide();
      });
      $(document).on('hide_variation', 'form.cart', function( event, variation ) {   
         $('p.price').html('" . $price . "');
      });
   " );
}

Stay Connected

Get in touch

Flatsome is the perfect theme for your shop, company websites or client websites. It has all the tools needed to create super fast responsive websites with amazing user experience.