3

I can successfully add item to the cart using this rest API from my APP.

POST /V1/carts/mine/items

However the item is added with a price of ZERO.

The new quote was created from the APP using this API.

POST /V1/carts/mine

But when I try to add an item from magento web the price is showing correct value.

I am using magento 2 .

asked Sep 22, 2016 at 5:44
1
  • This was 5 months ago and was there any solution? Its disappointing that magento dev experts aren't addressing this issue Commented Feb 23, 2017 at 8:44

2 Answers 2

5
Here is the solution of this issue
Open file 'vendor/magento/module-quote/Model/QuoteManagement.php'.
Find function 'createEmptyCartForCustomer'.
Add below code inside try{} (at start of try), before line number 234
$quote->getBillingAddress();
$quote->getShippingAddress()->setCollectShippingRates(true);
After adding these 2 lines it will not show 0 price again.
answered Dec 27, 2017 at 1:41
0

Here is the solution of this issue follow below steps

step 1) Go to file 'vendor/magento/module-quote/Model/QuoteManagement.php'(override this file using preference dnt make chanage in core files)

step 2) Edit this function 'createEmptyCartForCustomer'.

step 3) In try before saving quote line number 234 add below code

$quote->getBillingAddress();
$quote->getShippingAddress()->setCollectShippingRates(true);
answered Dec 19, 2019 at 12:47

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.