Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solved problem while two adding percentage condition. #312

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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