New Landing How can we help? Themeforest Theme Support Neighborhood Cart item count instead of total price

Viewing 15 posts - 1 through 15 (of 63 total)
  • #47332
    goldforu
    Member
    Post count: 4

    Hi, I want to display number of items in the header cart instead of the total price. example: 2 ITEMS IN THE SHOPPING BAG. This is very important for a shop because customers get scared and abandon the shopping when they keep seeing the total amount in the header!

    And please don’t tell me it’s customization! This is probably a small snippet of code change that can be useful for many of your customers as I’ve seen other users attempting to do it on this forum and failing!

    Thanks

    #48348
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please open to edit sf-header.php line 695 at /wp-content/themes/neighborhood/includes/swift-framework/sf-content-display/

    Find this code 
    $cart_output .= '<li class="parent shopping-bag-item"><a class="cart-contents" href="'.$woocommerce->cart->get_cart_url().'" title="'.__("View your shopping cart", "swiftframework").'"><i class="sf-cart"></i>'.$cart_total.'</a>';
    
    Replace with 
    $cart_output .= '<li class="parent shopping-bag-item"><a class="cart-contents" href="'.$woocommerce->cart->get_cart_url().'" title="'.__("View your shopping cart", "swiftframework").'"><i class="sf-cart"></i>'.$cart_count_text.'</a>';
    #48747
    goldforu
    Member
    Post count: 4

    Hi Mohammad,

    Thanks for the support. When I replace the above code, the cart items simply flash for a second and then return to the cart price. It seems like another code overrides it on load. You can see it here: http://dev6.envisionwebdesign.co/

    #48901
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Are you using any cache plugin or cache on server ? please post wordpress admin login detail so i can check and fix the issue .

    #48904
    goldforu
    Member
    Post count: 4
    This reply has been marked as private.
    #48914
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    I made some changes and it will take effect after some time . Please contact your hosting provider to clear all cache of your website .

    #48953
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Finally I have done it so please check .

    #48966
    bogo79
    Member
    Post count: 11

    Hi,
    I have that same problem.
    Iwanted to change the cart to item count instead of total trice and used the code provided above…
    the same thing happened that goldforu describes.
    Could you please post what exactly you have changed in WordPress to make it work? Thank you.

    #48991
    Mohammad – SUPPORT
    Moderator
    Post count: 27441
    Please open to edit sf-header.php line 695 at /wp-content/themes/neighborhood/includes/swift-framework/sf-content-display/ and sf-header.php line 695 at /wp-content/themes/neighborhood-child/ 
    
    Find this code 
    $cart_output .= '<li class="parent shopping-bag-item"><a class="cart-contents" href="'.$woocommerce->cart->get_cart_url().'" title="'.__("View your shopping cart", "swiftframework").'"><i class="sf-cart"></i>'.$cart_total.'</a>';
    
    Replace with 
    $cart_output .= '<li class="parent shopping-bag-item"><a class="cart-contents" href="'.$woocommerce->cart->get_cart_url().'" title="'.__("View your shopping cart", "swiftframework").'"><i class="sf-cart"></i>'.$cart_count_text.'</a>';
    #57827
    michaelagwunobi21
    Member
    Post count: 93

    @Mohammad – SUPPORT
    Hi, how can I have it in this format “‘bag image’ Cart (0)”

    #57832
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please open to edit sf-header.php line 695 at /wp-content/themes/neighborhood/includes/swift-framework/sf-content-display/

    1- Find this code 
    $cart_output .= '<li class="parent shopping-bag-item"><a class="cart-contents" href="'.$woocommerce->cart->get_cart_url().'" title="'.__("View your shopping cart", "swiftframework").'"><i class="sf-cart"></i>'.$cart_total.'</a>';
    
    Replace with 
    $cart_output .= '<li class="parent shopping-bag-item"><a class="cart-contents" href="'.$woocommerce->cart->get_cart_url().'" title="'.__("View your shopping cart", "swiftframework").'"><i class="sf-cart"></i>'.$cart_count_text.'</a>';
    
    2- Please open to edit sf-woocommerce.php line 28 to 41 at wp-content/themes/neighborhood/includes/swift-framework/
    Find this code 
    function sf_product_items_text($count) {
    		
    		$product_item_text = "";
    		
        	if ( $count > 1 ) {
            	$product_item_text = str_replace('%', number_format_i18n($count), __('% items', 'swiftframework'));
            } elseif ( $count == 0 ) {
            	$product_item_text = __('0 items', 'swiftframework');
            } else {
            	$product_item_text = __('1 item', 'swiftframework');
            }
            
            return $product_item_text;
    	}
    
    Replace with 
    
    function sf_product_items_text($count) {
    		
    		$product_item_text = "";
    		
        	if ( $count > 1 ) {
            	$product_item_text = str_replace('%', number_format_i18n($count), __('bag image Cart (%)', 'swiftframework'));
            } elseif ( $count == 0 ) {
            	$product_item_text = __('bag image Cart (0)', 'swiftframework');
            } else {
            	$product_item_text = __('bag image Cart (1)', 'swiftframework');
            }
            
            return $product_item_text;
    	}

    Hopefully it should work .

    Thanks
    With Best Regards
    Swift Ideas

    #57833
    michaelagwunobi21
    Member
    Post count: 93

    Thank you. It worked but it also keeps flashing. I’ve cleared the cache like you said above but it still continues to flash. Whats the solution?

    #57842
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please share wordpress admin login detail so i can look into this matter .

    Thanks
    With Best Regards

    #57844
    michaelagwunobi21
    Member
    Post count: 93
    This reply has been marked as private.
    #57847
    michaelagwunobi21
    Member
    Post count: 93
    This reply has been marked as private.
Viewing 15 posts - 1 through 15 (of 63 total)

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register