title: Display total order amount in woocommerce single product page
body: <p>I'm developing a very simple website for one of my business using woocommerce and WordPress as CMS. 
  I really liked the idea how in product-single page gravity form create a field for displaying the total amount, with an automatic update if any optional service is selected, before going to the checkout page.
  But I don't want to use gravity form since it has some limitations. Instead, I choose woocommerce for that and everything went well except that I don't get this feature in woocommerce. Before posting this thread here, I have researched as much I can and finally found out a plugin/extension called "Product add-ons" by woo theme. I have several products now on my website and each product has additional options with additional prices. 
  The plugin displays total order amount in two section 1. Options total and 2. Grand total(base price+option price).
  That's cool but the problem is it doesn't display the total amount until i select any option. 
  Please have a visit to a single product page so you can understand it better. <a href="http://edencleaners.sg/landed-property/" rel="nofollow noreferrer">http://edencleaners.sg/landed-property/</a></p>
  
  <p>Is there any way to display the order total amount permanently with an auto update if options are chosen? Is there any script or plugin for that you know of? Or anyway I can change the current plugin's script?</p>
  
  <p>I'm posting the js codes which I believe is used for calculation and displaying the total amount by the product addon plugin.</p>
  
  <pre><code>jQuery(document).ready(function($) {
  
      function init_addon_totals() {
  
          $('.cart').on( 'keyup change', '.product-addon input, .product-addon textarea', function() {
  
              if ( $(this).attr('maxlength') &gt; 0 ) {
  
                  var value = $(this).val();
                  var remaining = $(this).attr('maxlength') - value.length;
  
                  $(this).next('.chars_remaining').find('span').text( remaining );
  
              }
  
          } );
  
          $('.cart').find('.addon-custom, .addon-custom-textarea').each(function(){
  
              if ( $(this).attr('maxlength') &gt; 0 ) {
  
                  $(this).after('&lt;small class="chars_remaining"&gt;&lt;span&gt;' + $(this).attr('maxlength') + '&lt;/span&gt; ' + woocommerce_addons_params.i18n_remaining + '&lt;/small&gt;' );
  
              }
  
          } );
  
          $('.cart').on( 'change', '.product-addon input, .product-addon textarea, .product-addon select, input.qty', function() {
              var $cart = $(this).closest('.cart');
              $cart.trigger('woocommerce-product-addons-update');
          } );
  
          $('body').on('found_variation', '.variations_form', function( event, variation ) {
              var $variation_form = $(this);
              var $totals         = $variation_form.find('#product-addons-total');
  
              if ( $( variation.price_html ).find('.amount:last').size() ) {
                  product_price = $( variation.price_html ).find('.amount:last').text();
                  product_price = product_price.replace( woocommerce_addons_params.currency_format_thousand_sep, '' );
                  product_price = product_price.replace( woocommerce_addons_params.currency_format_decimal_sep, '.' );
                  product_price = product_price.replace(/[^0-9\.]/g, '');
                  product_price = parseFloat( product_price );
  
                  $totals.data( 'price', product_price );
              }
              $variation_form.trigger('woocommerce-product-addons-update');
          });
  
          $('.cart').bind( 'woocommerce-product-addons-update', function() {
              var total         = 0;
              var $cart         = $(this);
              var $totals       = $cart.find('#product-addons-total');
              var product_price = $totals.data( 'price' );
              var product_type  = $totals.data( 'type' );
  
              // Move totals
              if ( product_type == 'variable' ) {
                  $cart.find('.single_variation').after( $totals );
              }
  
              $cart.find('.addon').each(function() {
                  var addon_cost = 0;
  
                  if ( $(this).is('.addon-custom-price') ) {
                      addon_cost = $(this).val();
                  } else if ( $(this).is('.addon-input_multiplier') ) {
                      if( isNaN( $(this).val() ) || $(this).val() == "" ) { // Number inputs return blank when invalid
                          $(this).val('');
                          $(this).closest('p').find('.addon-alert').show();
                      } else {
                          if( $(this).val() != "" ){
                              $(this).val( Math.ceil( $(this).val() ) );
                          }
                          $(this).closest('p').find('.addon-alert').hide();
                      }
                      addon_cost = $(this).data('price') * $(this).val();
                  } else if ( $(this).is('.addon-checkbox, .addon-radio') ) {
                      if ( $(this).is(':checked') )
                          addon_cost = $(this).data('price');
                  } else if ( $(this).is('.addon-select') ) {
                      if ( $(this).val() )
                          addon_cost = $(this).find('option:selected').data('price');
                  } else {
                      if ( $(this).val() )
                          addon_cost = $(this).data('price');
                  }
  
                  if ( ! addon_cost )
                      addon_cost = 0;
  
                  total = parseFloat( total ) + parseFloat( addon_cost );
              } );
  
              var qty = parseFloat( $cart.find('input.qty').val() );
  
              if ( total &gt; 0 &amp;&amp; qty &gt; 0 ) {
  
                  total = parseFloat( total * qty );
  
                  var formatted_addon_total = accounting.formatMoney( total, {
                      symbol      : woocommerce_addons_params.currency_format_symbol,
                      decimal     : woocommerce_addons_params.currency_format_decimal_sep,
                      thousand    : woocommerce_addons_params.currency_format_thousand_sep,
                      precision   : woocommerce_addons_params.currency_format_num_decimals,
                      format      : woocommerce_addons_params.currency_format
                  } );
  
                  if ( product_price ) {
  
                      product_total_price = parseFloat( product_price * qty );
  
                      var formatted_grand_total = accounting.formatMoney( product_total_price + total, {
                          symbol      : woocommerce_addons_params.currency_format_symbol,
                          decimal     : woocommerce_addons_params.currency_format_decimal_sep,
                          thousand    : woocommerce_addons_params.currency_format_thousand_sep,
                          precision   : woocommerce_addons_params.currency_format_num_decimals,
                          format      : woocommerce_addons_params.currency_format
                      } );
                  }
  
                  html = '&lt;div class="product-addon-totals"&gt;&lt;div class="rb-option-total"&gt;&lt;label&gt;' + woocommerce_addons_params.i18n_addon_total + '&lt;/label&gt;&lt;span class="amount amount-alt"&gt;' + formatted_addon_total + '&lt;/span&gt;&lt;input type="hidden" class="amount-alt" value="' + formatted_addon_total + '" /&gt;&lt;/div&gt;';
  
                  if ( formatted_grand_total ) {
                      html = html + '&lt;div class="rb-grand-total"&gt;&lt;label&gt;' + woocommerce_addons_params.i18n_grand_total + '&lt;/label&gt;&lt;span class="amount"&gt;' + formatted_grand_total + '&lt;/span&gt;&lt;/div&gt;';
                  }
  
                  html = html + '&lt;/div&gt;';
  
                  $totals.html( html );
  
              } else {
                  $totals.empty();
              }
  
              $('body').trigger('updated_addons');
  
          } );
  
          $('.cart').find('.addon-custom, .addon-custom-textarea, .product-addon input, .product-addon textarea, .product-addon select, input.qty').change();
      }
  
      init_addon_totals();
  
      $( '.variations_form .product-addon' ).closest( '.cart' ).find( '.variations select' ).change();
  
      // Quick view
      $('body').on('quick-view-displayed', function() {
          init_addon_totals();
      });
  });
  </code></pre>