WordPress
1
Вклад в тег
jQuery(document).on('found_variation', 'form.cart', function( event, variation ) {
var qtty = jQuery('.summary .quantity .qty').val();
currency = currency = ' <?php echo get_woocommerce_currency_symbol(); ?>',
vprice = jQuery('.woocommerce-variation-price .amount').text().replace(/ /g,''),
parsePrice = parseFloat(vprice)*qtty,
totalPrice = 'У кошик за ' + parsePrice.toFixed(2) + currency;
jQuery('.summary .single_add_to_cart_button').html(totalPrice);
jQuery( '[name=quantity]' ).on( 'input change', function() {
var qtty = jQuery('.summary .quantity .qty').val();
currency = currency = ' <?php echo get_woocommerce_currency_symbol(); ?>',
vprice = jQuery('.woocommerce-variation-price .amount').text().replace(/ /g,''),
parsePrice = parseFloat(vprice)*qtty,
totalPrice = 'У кошик за ' + parsePrice.toFixed(2) + currency;
jQuery('.summary .single_add_to_cart_button').html(totalPrice);
});
});
jQuery( '.product-type-simple [name=quantity]' ).on( 'input change', function() {
var qtty = jQuery('.summary .quantity .qty').val();
currency = currency = ' <?php echo get_woocommerce_currency_symbol(); ?>',
vprice = jQuery('.summary .woocommerce-Price-amount').text().replace(/ /g,''),
parsePrice = parseFloat(vprice)*qtty,
totalPrice = 'У кошик за ' + parsePrice.toFixed(2) + currency;
jQuery('.summary .single_add_to_cart_button').html(totalPrice);
});