darryldecode / laravelshoppingcart

Shopping Cart Implementation for Laravel Framework
1.34k stars 443 forks source link

Wrong SubTotal and Total #152

Open dfxs91 opened 6 years ago

dfxs91 commented 6 years ago

Hi,

To explain my issue, I have two items in the cart, and one of the items has an discount on the price, but the value that I get on SubTotal and Total are the sum of the items prices, Doesn't apply the discont. And with method getConditionsByType the discount is there, Have this happened to anyone??

Thanks in advance.

idragon81 commented 5 years ago

did you add the target for the value Should be similar to this

 $promocodeCondition = new \Darryldecode\Cart\CartCondition([
                'name' => 'promocode',
                'type' => 'promocode',
                'target' => 'subtotal',
                'value' => '-50%',
                'attribute' => [
                    'code' => $promocode
                ]
            ]);