darryldecode / laravelshoppingcart

Shopping Cart Implementation for Laravel Framework
1.33k stars 414 forks source link

How to get total price of the court without applying tax to it #228

Open maliknaqibullah opened 4 years ago

maliknaqibullah commented 4 years ago

i want to display the total price of the cart items without applying tax to it then subtotal tax applied to it for example: in html page i want the result something like this `total price : 400 tax : 5%

subtotal : 400+tax ` if i apply tax to target total or subtotal in both case i can not get the total without tax can you please help me thank you

Wolpdg commented 4 years ago

I have the same problem. My controller: ` $product = Product::find($request->product_id);

    $saleCondition = new \Darryldecode\Cart\CartCondition(array(
        'name' => 'MISC',
        'type' => 'misc',
        'value' => '+100'
    ));

    \Cart::add([
        'id' => $product->id,
        'name' => $product->title,
        'price' => $product->price,
        'quantity' => 1,
        'attributes' => [],
        'conditions' => $saleCondition
    ])->associate('App\Product');    `

getTotal and getSubTotal show me the same with tax +100