LaravelShoppingcart icon indicating copy to clipboard operation
LaravelShoppingcart copied to clipboard

Tax Customization

Open alinazir opened this issue 6 years ago • 9 comments

Sir I wanna ask you one thing , how to customize the tax value

alinazir avatar Mar 10 '18 13:03 alinazir

This can be set in config/cart.php.

See here for an example file - https://github.com/Crinsane/LaravelShoppingcart/blob/master/config/cart.php

olimortimer avatar Mar 13 '18 22:03 olimortimer

I think the question is how to customize the tax for each product this in the config will add default tax for all the products, what if each product has it's own tax?

johnef avatar Mar 26 '18 08:03 johnef

+1 I would like support for adding both taxable and non-taxable items to the same cart.

magnosis avatar Apr 04 '18 20:04 magnosis

publishing the config file and editing the value doesn't seem to override the package config file's value

sjsiegel001 avatar Apr 22 '18 14:04 sjsiegel001

+1 I would like support for different tax per product Edit: Found somthing really usefull. https://github.com/Crinsane/LaravelShoppingcart/wiki/Adding-new-tax-to-cart-item This worked for me.

jelmerbou avatar May 03 '18 07:05 jelmerbou

@jelmerbou Thanks , I was looking for the same , just want to ask if you know while looping all products in car.blade.php how do i display tax of each rowId i.e each product tax , is there any method defined for this

shanks25 avatar Sep 27 '19 07:09 shanks25

@jelmerbou Thanks , I was looking for the same , just want to ask if you know while looping all products in car.blade.php how do i display tax of each rowId i.e each product tax , is there any method defined for this

You can find all available methods in the Cart.php and CartItem.php. There are just methods for the tax as an amount of money, not percentage. You have to re-calculate that percentage yourself or get it from where you got it in the first place since there is no way to access the private taxRate. You can fork this repository and add the functionality yourself or provide a PR to one of the many forks. I might add it to mine.

bumbummen99 avatar Sep 27 '19 12:09 bumbummen99

@bumbummen99 Yeah Thanks For The Suggestions .

shanks25 avatar Sep 27 '19 12:09 shanks25

@shanks25 It is now in my fork, you can look at the referenced commit to find out how to get the desired behavior but to keep things simple i basically changed $taxRate to be a public member. You just have to remember to use setTaxRate() instead of direct access for chaining method calls as setTaxRate() will return $this.

bumbummen99 avatar Sep 27 '19 17:09 bumbummen99