Skip to content

Conversation

@himu3355
Copy link

I just updated getTotal() method.
I have a problem while added two percentage conditions. Ex.
One for tax

$condition1 = new \Darryldecode\Cart\CartCondition(array(
	'name' => 'GST',
	'type' => 'GST',
	'target' => 'total',
	'value' => '5%',
	'attributes' => array( // attributes field is optional
		'description' => 'Value added tax'
	)
));

And another one for coupon

$condition2 = new \Darryldecode\Cart\CartCondition(array(
	'name' => 'COUPON',
	'type' => 'COUPON',
	'target' => 'total',
	'value' => '-10%',
	'attributes' => array( // attributes field is optional
		'description' => 'Value added tax'
	)
));

Applying these two conditions, the result is very strange.
I think it's work in my pull request.
and I hope it doesn't affect other results.

… counting sequentially it geting wrong answer while adding two or more percentage value of conditions. So I first applied the value of the condition in subtotal and took the sum of the conditions. and added with subTotal.
@himu3355 himu3355 changed the title Solved problem while two percentage condition. Solved problem while two adding percentage condition. May 21, 2021
@joelwmale
Copy link

@himu3355 I believe I've got this issue fixed in my maintained and forked version here: https://github.com/wearepixel/laravel-cart

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants