cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot get the product's price included tax by rest api

Cannot get the product's price included tax by rest api

Feature request from davidnguyen2205, posted on GitHub Oct 27, 2016

Preconditions

Magento 2.1.1

Steps to reproduce

  1. Add tax rate & rule (10%)
  2. Change some settings in Stores > Configuration > Sales > Tax: price incl tax
  3. Add a new product (for testing): Price: $10
  4. Save then indexer:reindex and clear cache or even disable cache.

    Expected result

  5. The price in frontend included tax. The test product's price is $11.
  6. The price when calling rest api ( /V1/products/SKU + /V1/carts/mine + /V1/carts/mine/items ) included tax. The test product's price is $11.

    Actual result

  7. On website, it's great.
  8. On the response, the price is always excluded tax.

Is that missing something in my steps to set up the product's price included tax? Or is that an issue?

9 Comments
apiuser
New Member

Comment from olysenko, posted on GitHub Oct 31, 2016

Hi, thank you for your report. To get full prices with tax, discount, shipping etc in the shopping cart use request /V1/carts/mine/totals. Calls like /V1/carts/mine and /V1/carts/mine/items are not supported price calculation. Was this comment helpful for you?

apiuser
New Member

Comment from PaulBoss, posted on GitHub Nov 01, 2016

It would be great if there is a way to get the same price the frontend is showing available in the API for products. Right now you can get price, special_price but special logic has to be made by the programmer implementing the API.

As for tax: I'd like to see that the API returns both prices, with and without tax. Then you can easily select which price you want to synchronize via the API. It is a PITA if you need to re-create the same tax logic which is already available in Magento

apiuser
New Member

Comment from davidnguyen2205, posted on GitHub Nov 01, 2016

Ya, as @PaulBoss said. We should get prices with or without tax as same way the frontend showing. For now, I must hack by getting tax rate with admin token then implementing in the price calculation before showing on my app... and something is going to be bad if using search via the api.... It's so painful Smiley Sad

apiuser
New Member

Comment from PaulBoss, posted on GitHub Nov 09, 2016

The same happens for pricing rules. The API only returns the price from the database without taking pricing rules into account. We are trying to sync products, not carts, to our platform so we can send out an email newsletter with some products in it. Currently there seems to be no way to get the price the frontend is showing via the API (e.g. finalPrice).

apiuser
New Member

Comment from PaulBoss, posted on GitHub Nov 25, 2016

Is there any update?

apiuser
New Member

Comment from olysenko, posted on GitHub Nov 25, 2016

Hi all, internal ticket was created MAGETWO-61408

apiuser
New Member

Comment from misha-kotov, posted on GitHub Mar 16, 2017

This should not be considered a bug since the original catalog API was never designed to serve this purpose, it was meant to serve up product information as it is set up in the catalog. There should be an additional price service built to expose the "final" storefront price given a certain customer context. Since price can vary by customer, customer segment, tax class, etc, this context will need to be passed as input to the service. I have written this up as a Magento feature request for now: MAGETWO-66253. In the meantime, you may find this article useful.

lrnzsfr
Occasional Contributor

I am just adding myself to this conversation, I am currently solving with a plugin, but I would be very happy to switch to a core API if it will be implemented.

hnaseri
Regular Visitor
Is there any update for this feature request?