Okay
  Public Ticket #3028264
Replace Variable Price With Active Variation Price
Closed

Comments

  •  3
    natah started the conversation

    Hi!

    i found this code 

    /**https://businessbloomer.com/bloomer-armada/*/
     
    add_action( 'woocommerce_variable_add_to_cart', 'bbloomer_update_price_with_variation_price' );
      
    function bbloomer_update_price_with_variation_price() {
       global $product;
       $price = $product->get_price_html();
       wc_enqueue_js( "     
          $(document).on('found_variation', 'form.cart', function( event, variation ) {  
             $('.summary > p.price').html(variation.price_html);
             $('.woocommerce-variation-price').hide();
          });
          $(document).on('hide_variation', 'form.cart', function( event, variation ) {  
             $('.summary > p.price').html('" . $price . "');
          });
       " );
    }


    at shop page and product page is working

    but at the quick view  your theme has the range at top and the active variable price is down.

    I want the price range to be replaced by the active variable price

    please advice me ho to fix that.

    thanks in advance

  •  1,877
    Judith replied

    Hi Natah,

    Thanks for keeping in touch.

    Please allow me to escalate this to the developer to assist further.

    Thanks.

  •  1,070
    ThemeNectar replied

    Hey Natah,

    You'll need another script to handle the quick view modal, as there is different considerations when dealing with content loaded asynchronously. Keep you other snippet active and also add the following to your child theme functions.php file:

    add_action( 'wp_footer', 'salient_update_price_with_variation_price' );
      
    function salient_update_price_with_variation_price() {
       wc_enqueue_js( "     
          $(document).on('found_variation', 'form.cart', function( event, variation ) {  
             var clone = $('.nectar-quick-view-box div.product .summary p.price').clone();
             $('.nectar-quick-view-box div.product .summary p.price').addClass('original').hide();
             $('.nectar-quick-view-box .woocommerce-variation-price').hide();
             clone.addClass('clone').html(variation.price_html).insertAfter('.nectar-quick-view-box .product_title');
          });
          $(document).on('hide_variation', 'form.cart', function( event, variation ) {  
             $('.nectar-quick-view-box div.product .summary p.original').show();
             $('.nectar-quick-view-box div.product .summary p.clone').remove();
          });
       " );
    }
    

    Cheers