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

Subtotal/Tax Calculations #26

Closed
macmedia opened this issue Jul 30, 2019 · 1 comment
Closed

Subtotal/Tax Calculations #26

macmedia opened this issue Jul 30, 2019 · 1 comment

Comments

@macmedia
Copy link

Subtotal subtracts (wrong amount at that) tax from item price?
Not sure if this a bug, or by design. When adding an item to the cart with a price of $100 and a tax rate of %10, the subtotal shows $90.91.

  1. Shouldn't the subtotal be the price of the item(s) in the cart? Qty 1 @ $100 is $100+tax
  2. Why is the tax coming up as $9.09 ($100 * 10% = $110)
Subtotal = 100.00
Tax      =  10.00
=================
Total    = 110.00

Response Object

shoppingCart:Object
count:1
discounts:Array[0]
items:Array[1]
sub_total:90.9090909090909
sub_total_formatted:"$90.91"
tax_total:9.090909090909092
tax_total_formatted:"$9.09"
total:100
total_formatted:"$100.00"
shoppingCartCount:1
shoppingCartEmpty:false

To Reproduce
Steps to reproduce the behavior:

  1. Add item to cart
let data = {
   'shoppable_type': 'App\\Model',
   'shoppable_id': product,
   'quantity': 1,
   'price': 100.00
}
this.$http.post('/api/shopr/cart/items',data)

Expected behavior

shoppingCart:Object
count:1
discounts:Array[0]
items:Array[1]
sub_total:100.00
sub_total_formatted:"$100.00"
tax_total:10.000
tax_total_formatted:"$10.00"
total:110
total_formatted:"$110.00"
shoppingCartCount:1
shoppingCartEmpty:false

Desktop (please complete the following information):

  • OS: MacOS 10.14.6
  • Browser: Chrome
  • Version: Version 75.0.3770.142

Additional context

Config file: shopr.php

/*
 * The tax percentage.
 */

'tax' => 10,
@mattias-persson
Copy link
Contributor

mattias-persson commented Jul 30, 2019

Hi! Thanks for your question. The tax is calculated on the gross price, not the net price. So basically you'd set $110 as the price on your shoppable (including tax) and the tax will be correctly calculated. For more details, check this out: https://www.omnicalculator.com/finance/sales_tax?c=USD&v=tax:10!perc!l,gross:100.

I hope that helps! I'm closing this as the calculation is by design and not a bug.

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

No branches or pull requests

2 participants