• Resolved Sho-Down

    (@sho-down)


    I updated my testing site from 2.11.6 to the latest version of EDD and the following code I’ve used forever in my top menu bar shows the total price of the items twice now:

    <span class="header-cart-total"><?php echo edd_cart_total(); ?></span> <span class="header-cart edd-cart-quantity"><?php echo edd_get_cart_quantity(); ?></span>

    I changed it to:

    <span class="header-cart-total"><?php echo edd_get_cart_total(); ?></span> <span class="header-cart edd-cart-quantity"><?php echo edd_get_cart_quantity(); ?></span>

    And now it’s back to showing the total price once as it should but the issue is it shows “0” when nothing is in the cart, the original code showed “$0.00” when the cart was empty which is what I want. Was something changed with edd_cart_total() in 3.0?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Sho-Down

    (@sho-down)

    Also needed to add, I have this code in a custom scripts file which may have something to do with it?

    //EDD UPDATE CART TOTAL PRICE IN HEADER
    jQuery(document).ready(function($) {
    	body = $( document.body );
    	var header_cart_total = $('.header-cart-total');
    	body.on('edd_cart_item_added',function(event, response){
    		header_cart_total.html(response.subtotal);
    	});
    	body.on('edd_cart_item_removed',function(event, response){
    		header_cart_total.html (response.subtotal);
    	});
    });
    Plugin Support Mihai Joldis

    (@misulicus)

    Hey @sho-down

    I just tested “edd_cart_total()” and it is showing the formatted cart total price as intended.
    Try removing the JavaScript code that you have and see if it’s showing correctly without it.

    Thread Starter Sho-Down

    (@sho-down)

    Thanks for the response Mihai, I think I figured it out. I use a menu plugin for mobile devices and the formatted cart total was working fine when I checked on my iPad/phone so I looked at the code I use for that plugin and it has edd_cart_total( false ) in it:

    //EDD Mini Cart Shortcode [eddminicart] For Mobile Menu Plugin
    function eddminicartfunc() {
      return 
        '<div class="mobilemenucart">
           <i class="fa fa-shopping-cart"></i>
           <span class="header-cart-total"> ' . edd_cart_total( false ) . ' </span>
           <span class="header-cart edd-cart-quantity">' . edd_get_cart_quantity() . '</span>
        </div>';
    }
    add_shortcode( 'eddminicart', 'eddminicartfunc' );

    So using edd_cart_total() shows the total price of the cart twice and edd_cart_total(false) shows it correctly. Any idea what changed? I have edd_cart_total() working fine on my live site with EDD 2.11.6.

    Plugin Support Mihai Joldis

    (@misulicus)

    Hey there.

    I am not able to replicate this issue on my end at all so I wonder if something else could be causing it perhaps on your site.

    Thread Starter Sho-Down

    (@sho-down)

    Not sure @misulicus, it’s working correctly on both of my site now so it’s all good. Thanks for the help!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘“edd_cart_total” showing total price twice’ is closed to new replies.