How to show Total Product Price

Open
REHub - Price Comparison, Affiliate Marketing, Multi Vendor Store, Community Theme REHub - Price Comparison, Affiliate Marketing, Multi Vendor Store, Community Theme January 15, 2020
Login to reply
Smart Media
4 years ago

Thanks ! !
It would be very good if such a function appears!

Igor Sunz Support Agent
4 years ago

You are right. This is useful function, but not such way as your code. Cart function is in header and user see total amount. Your code will increase server load. Total amount of product should be visible in price and not separately. I can add some tweaks in code for this

Smart Media
4 years ago

well !
I made the code that showed

it works (in the photo) , 

very bad and it’s not clear why ReHub doesn’t have such a simple and very useful function

I thought support is a bit more ....
Thank you ticket is closed

Igor Sunz Support Agent
4 years ago

Any custom changes in functions of site require customization. But you can try to find ready plugin for such purpose. 

Maybe we will add something similar in future updates, there is better solutions than your code

Smart Media
4 years ago

Thanks, but can this be done without additional code, REHub  Theme resources?

Igor Sunz Support Agent
4 years ago

I already replied. Code looks correct, except fact that it has no closed tags, maybe you copied not full code from forum

Smart Media
4 years ago
advanced customization I can do myselfI need an answer from support! WILL IT WORK?
Smart Media commented privately
Igor Sunz Support Agent
4 years ago

sorry, but advanced customization is not part of support. If you want to hire customization team - webbizdirect@gmail.com

However, this code looks correct, but you don't have latest closed tags

<?php

}

Also, you must make correct customization http://rehubdocs.wpsoul.com/docs/rehub-theme/child-themes/how-to-customize-your-theme/

Smart Media
4 years ago

Hello !

Tell me how I can do this functionality in your REHub Theme

I need what to do show Total Product Price 

I give an example in the photo

I tried to write such a code as advised on the forums, but it doesn’t want to work


....

add_action('woocommerce_single_product_summary', 'pt_woocommerce_product_total_price', 35);

 

function pt_woocommerce_product_total_price() {

    global $woocommerce, $product;

    // Setup our Html to show the totoal price

    echo sprintf('<div id="pt-product-total-price" style="margin-bottom:20px;display:none">%s %s</div>', __('Product Total:', 'woocommerce'), '<span class="price">' . $product->get_price() . '</span>');

    echo sprintf('<div id="pt-cart-total-price" style="margin-bottom:20px;display:none">%s %s</div>', __('Cart Total:', 'woocommerce'), '<span class="price">' . $product->get_price() . '</span>');

    ?>

    <script>

        jQuery(function ($) {

            var product_price = <?php echo $product->get_price(); ?>,

                    current_cart_total = <?php echo $woocommerce->cart->cart_contents_total; ?>,

                    currency = '<?php echo get_woocommerce_currency_symbol(); ?>';

 

            $('[name=quantity]').change(function () {

                if (!(this.value < 1)) {

                    var product_total = parseFloat(product_price * this.value),

                            cart_total = parseFloat(product_total + current_cart_total);

 

                    $('#pt-product-total-price .price').html(currency + product_total.toFixed(2));

                    $('#pt-cart-total-price .price').html(currency + cart_total.toFixed(2));

                }

                $('#pt-product-total-price,#pt-cart-total-price').toggle(!(this.value <= 1));

 

            });

        });

    </script>