Home Forums WoodMart support forum Calculate total price in the single product page

Calculate total price in the single product page

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #512194

    cmdtung
    Participant

    Hi,

    I have tried some codes to display the total price in the single product page after the user edit the number of quantity but it could not handle those variation products in different price and grouped products.

    Could you tell me any solutions for us to display the total price before the user add to cart ?

    See the attached screen for more detail.

    Best Regards
    DARRY

    Attachments:
    You must be logged in to view attached files.
    #512315

    Hello,

    Please add below Custom Code below to the functions.php file in the Child theme.

    add_action( ‘woocommerce_after_add_to_cart_button’, ‘pk_product_price_recalculate’ );

    function pk_product_price_recalculate() {
    	global $product;
    	echo '<div id="subtot" style="display:inline-block;">Total: <span></span></div>';
    	$price = $product->get_price();
    	$currency = get_woocommerce_currency_symbol();
    	wc_enqueue_js( "		
    		$('[name=quantity]').on('input change', function() { 
    			var qty = $(this).val();
    			var price = '" . esc_js( $price ) . "';
    			var price_string = (price*qty).toFixed(2);
    			$('#subtot > span').html('" . esc_js( $currency ) . "'+price_string);
    		}).change();
    	" );
    }

    Best Regards.

    #512422

    cmdtung
    Participant

    Hi,

    I have tried this code before.

    There are bugs shown as the attached file.

    I find a plugin called Product Total Price for WooCommerce which could calculate simple and variation products except grouped products. However, the plugin’s short code added in the page with elementor. Then the elementor will display error if we want to edit it again.

    If you takes a look on the code, you may find the solution for me and your customers who are using WoodMart.

    Thanks you for your help in advance.

    Best Regards
    DARRY

    Attachments:
    You must be logged in to view attached files.
    #512539

    Hello,

    Sorry to say such modification requires complicated code customization which is not covered by our support.

    Hope you can understand!

    Best Regards.

    #512717

    cmdtung
    Participant

    Hi,

    Thanks you for your help.

    The only solution is used the plugin as temp solution. In the long run, WoodMart should provide this feature for the customer in order to enhance its themem

    Thanks.

    #512789

    Hello,

    Ok thanks for the suggestion. You can add this suggestion as a feature request page where you can describe your suggestion and ideas in more detail (https://woodmart.canny.io/feature-requests) and it gives the community a chance to see and support it.

    Best Regards.

    #516127

    cmdtung
    Participant

    I have added this request in the feature list.

    The case is closed.

    #516194

    Most Welcome!!!.

    I’m so happy to hear you are pleased with the Theme and Support. XTEMOS strives to deliver the best customer experience, and it makes our day to hear we have accomplished that.

    We count ourselves lucky to have you as a customer. You can always reach us at any time. We are always here to help you.

    Thanks for contacting us.
    Have a great day.

    Topic Closed.
    Best Regards.

Viewing 8 posts - 1 through 8 (of 8 total)

The topic ‘Calculate total price in the single product page’ is closed to new replies.