Skip to content

Cart has nothing to get total quantiy #66

Closed

Description

@bitbucket-import

total_items() returns total items in the cart. For example we have 2 items in the cart Apple and Orange, and there 2(qty) Apples and 1(qty) Orange. total_items() returns 2, because there are 2 items. But there should be a method which should return 2(qty). Should be like this

{{{

!php

function total_qty()
{
$total_qty=0;

foreach($this->contents() as $item)
{   
    (double)$total_qty+=(double)$item['qty'];
}
return $total_qty;

}
}}}

Activity

  1. philsturgeon commented on Apr 26, 2012

    @philsturgeon
    Contributor

    It has that now!

  2. added a commit that references this issue on Mar 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions