Closed gruntlord6 closed 8 years ago
Thanks for posting the bug! There's something going wrong here :confused:
Can you post the raw API output for that product, then I will have everything I need to reproduce the issue. To get the raw output:
This should return a JSON object, just copy and paste that in a comment.
from what I can see this is what you are looking for.
{
"title": "Ultra-Pro Black Satin Tower Deck Box",
"id": 1641,
"created_at": "2015-10-03T02:20:00Z",
"updated_at": "2015-10-03T02:45:24Z",
"type": "simple",
"status": "publish",
"downloadable": false,
"virtual": false,
"sku": "074427841737",
"price": "13.26",
"regular_price": "13.26",
"sale_price": null,
"price_html": "<span class=\"amount\">$13.26<\/span> <small class=\"woocommerce-price-suffix\">(<span class=\"amount\">$14.99<\/span> after tax)<\/small>",
"taxable": true,
"tax_status": "taxable",
"tax_class": "",
"managing_stock": true,
"stock_quantity": 0,
"in_stock": false,
"backorders_allowed": false,
"backordered": false,
"sold_individually": false,
"purchaseable": true,
"featured": false,
"visible": true,
"on_sale": false,
"shipping_required": true,
"shipping_taxable": true,
"shipping_class": "",
"shipping_class_id": null,
"parent_id": 0,
"categories": ["Deck Boxes", "Ultra-Pro"],
"featured_src": "https:\/\/duelkingdom.ca\/wp-content\/uploads\/2015\/10\/Black-Satin-Tower-180x180.png",
"attributes": [{
"name": "Condition",
"slug": "condition",
"position": 0,
"visible": true,
"variation": false,
"options": ["Sealed"]
}],
"purchase_note": "",
"total_sales": 1,
"variations": [],
"barcode": "074427841737"
}
That's it, thanks.
So, what's happening here is the REST API is giving a rounded price for the product. The actual values for the product are:
price | 13.2654867257 |
---|---|
13% tax | 1.72451327434 |
total | 14.99 |
Because the WC REST API returns a rounded value the calculated tax is wrong. I will post an issue to WooCommerce to try and get the bug resolved. As a test you could remove the rounding done by WooCommerce, ie: change the following to:
'price' => $product->get_price(),
'regular_price' => $product->get_regular_price(),
If you clear your local cache and redownload the products you should get the right price in the POS.
Took me a bit of digging to find the lines I needed to fix, but it works exactly as you say, the price in the POS is now correct. Not sure who at WC thought it was a good idea to round the result returned to the API, but I'm once again very impressed at your turn around time :)
Once my store takes off I'll have to go Pro ;)
In the webstore, I have a product set to appear as 14.99 after tax. In the POS mode however, the product appears as 14.98 after tax. I have attached screenshots below.