Discussions

Text removal "item"

Hy,

i want to remove the word "item" that appears in the shopping cart, as i just use a shopping bag icon and implement the number of total items in cart. Rather removing the word or getting the total amount of products in cart via code.

Any suggestion?

Posted: Jan 29, 2013

Comments

sammyfm on January 29, 2013

<?php
global $user;
$quantity = 0;

$order = commerce_cart_order_load($user->uid);

if (
$order) {
   
$wrapper = entity_metadata_wrapper('commerce_order', $order);
   
$line_items = $wrapper->commerce_line_items;
   
$quantity = commerce_line_items_quantity($line_items, commerce_product_line_item_types());
   
$total = commerce_line_items_total($line_items);
   
$currency = commerce_currency_load($total['currency_code']);
}

print
format_plural($quantity, '1 item', '@count items'); ?>