moltin / laravel-cart

Laravel Facade and Service Provider for Moltin\Cart
276 stars 87 forks source link

Item tax doesn't take quantity into account... #10

Closed adamkearsley closed 10 years ago

adamkearsley commented 10 years ago

Hi, Great addon! Really enjoying using it. I had an issue when viewing the amount of tax on each item, you have not taken quantity of items into account, so when i add 10 of the same item the items tax only shows the value for 1 of these items. This is also then reflected in the totals. My proposed fix is below...

Item.php

/**
 * Return the total tax for this item
 * 
 * @return float
 */
public function tax()
{
    return $this->tax->rate($this->price);
}

Should be

/**
 * Return the total tax for this item
 * 
 * @return float
 */
public function tax()
{
    return $this->tax->rate($this->price*$this->quantity);
}
chrisnharvey commented 10 years ago

This has now been fixed in moltin/cart@4330208072. Please run composer update to see the latest changes.

I have also added the option to show the tax for a single item (as it does now) if you choose to view it that way.