Digital experiences for all disciplines
New Landing › How can we help? › Themeforest Theme Support › Neighborhood › Cart item count instead of total price
New Landing › How can we help? › Themeforest Theme Support › Neighborhood › Cart item count instead of total price
- This topic has 62 replies, 8 voices, and was last updated 10 years by Rui Guerreiro – SUPPORT.
-
Posted in: Neighborhood
-
February 7, 2014 at 7:47 pm #47332
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
February 12, 2014 at 4:37 pm #48348Hi,
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>';
February 13, 2014 at 5:04 pm #48747Hi 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/
February 14, 2014 at 5:57 am #48901Hi,
Are you using any cache plugin or cache on server ? please post wordpress admin login detail so i can check and fix the issue .February 14, 2014 at 6:19 am #48904This reply has been marked as private.February 14, 2014 at 7:23 am #48914Hi,
I made some changes and it will take effect after some time . Please contact your hosting provider to clear all cache of your website .February 14, 2014 at 9:31 am #48953Hi,
Finally I have done it so please check .February 14, 2014 at 10:13 am #48966Hi,
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.February 14, 2014 at 12:24 pm #48991Please 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>';
March 15, 2014 at 10:59 pm #57827@Mohammad – SUPPORT
Hi, how can I have it in this format “‘bag image’ Cart (0)”March 16, 2014 at 3:31 am #57832Hi,
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 IdeasMarch 16, 2014 at 7:49 am #57833Thank 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?
March 16, 2014 at 11:16 am #57842Hi,
Please share wordpress admin login detail so i can look into this matter .Thanks
With Best RegardsMarch 16, 2014 at 11:33 am #57844This reply has been marked as private.March 16, 2014 at 12:08 pm #57847This reply has been marked as private. -
Posted in: Neighborhood
You must be logged in and have valid license to reply to this topic.