LaravelShoppingcart Tax

Created on 28 Jan 2017  路  14Comments  路  Source: Crinsane/LaravelShoppingcart

i don't wan't tax how can i remove

Most helpful comment

@abr4xas Thanks man :D

I'm still new in laravel , just trying to grow myself up by solving others questions.

Thank you for the nice solution

All 14 comments

Modify it at /config/cart.php
you'll see
[ 'tax' => 20]
change it to 0

return [

/*
|--------------------------------------------------------------------------
| Default tax rate
|--------------------------------------------------------------------------
|
| This default tax rate will be used when you make a class implement the
| Taxable interface and use the HasTax trait.
|
*/

'tax' => 21,

/*
|--------------------------------------------------------------------------
| Shoppingcart database settings
|--------------------------------------------------------------------------
|
| Here you can set the connection that the shoppingcart should use when
| storing and restoring a cart.
|
*/

'database' => [

    'connection' => null,

    'table' => 'shoppingcart',

],

/*
|--------------------------------------------------------------------------
| Destroy the cart on user logout
|--------------------------------------------------------------------------
|
| When this option is set to 'true' the cart will automatically
| destroy all cart instances when the user logs out.
|
*/

'destroy_on_logout' => false,

/*
|--------------------------------------------------------------------------
| Default number format
|--------------------------------------------------------------------------
|
| This defaults will be used for the formated numbers if you don't
| set them in the method call.
|
*/

'format' => [

    'decimals' => 2,

    'decimal_point' => '.',

    'thousand_seperator' => ','

],

];

'tax' => 21,

i change this to 0 but not working

Its work thank you so much :)

if i want tax come from database so what can i do?

If u want tax come from database...
The different tax is due to the Customers or the Products ?

I want customer change by own

For diffrent product or for all products

If u want to have different tax for each product then I'll prefer to ...

  1. Add a new column named 'tax' in the products database.
  2. Add the Tax value in the additional place like ['size']

3. Change or Add a function in Cart.php

Maybe I'm not understand what's your question is.. becasue
If you want to have different tax for different product, then why not just add it on the price.?

So how i calculate tax in cart

I want like i create diffrent tax when i add new product so its ask me wich tax you want to apply for this product in select drop down

  1. If you add a new column in databse , you'll see what you just add in the create page.
  2. With the Cart::add() , just modify the price.
    Steps:
    Step1 : Get the [Price],[Tax] value out of the database
    Step2: Add to the cart with [Price] * [Tax]

@Polly3919 I do not agree to:

Add the Tax value in the additional place like ['size']

You can use: setTax($rowId, $taxRate) to add the new tax to the item :smile:

EDIT

Check this wiki page: Adding new tax to cart item.

@abr4xas Thanks man :D

I'm still new in laravel , just trying to grow myself up by solving others questions.

Thank you for the nice solution

Was this page helpful?
0 / 5 - 0 ratings