Home › Forums › WoodMart support forum › Calculate total price in the single product page
Calculate total price in the single product page
- This topic has 7 replies, 2 voices, and was last updated 1 year, 3 months ago by
Aizaz Imtiaz Awan.
-
AuthorPosts
-
November 14, 2023 at 11:33 am #512194
cmdtungParticipantHi,
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
DARRYAttachments:
You must be logged in to view attached files.November 14, 2023 at 5:12 pm #512315
Aizaz Imtiaz AwanKeymasterHello,
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.
November 15, 2023 at 4:37 am #512422
cmdtungParticipantHi,
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
DARRYAttachments:
You must be logged in to view attached files.November 15, 2023 at 12:36 pm #512539
Aizaz Imtiaz AwanKeymasterHello,
Sorry to say such modification requires complicated code customization which is not covered by our support.
Hope you can understand!
Best Regards.
November 16, 2023 at 4:01 am #512717
cmdtungParticipantHi,
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.
November 16, 2023 at 11:08 am #512789
Aizaz Imtiaz AwanKeymasterHello,
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.
November 28, 2023 at 6:40 am #516127
cmdtungParticipantI have added this request in the feature list.
The case is closed.
November 28, 2023 at 10:24 am #516194
Aizaz Imtiaz AwanKeymasterMost 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. -
AuthorPosts
The topic ‘Calculate total price in the single product page’ is closed to new replies.
- You must be logged in to create new topics. Login / Register