You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 3, 2024. It is now read-only.
Using shipping broker as a delivery method source.
Scenario:
not logged in user is adding one (or more) product into the new cart -> a new guest cart is created with this product as a item
user goes to the cart, and goes to the avarda checkout -> user can see shipping methods. There is also a items call: https://stage.checkout-api.avarda.com/api/partner/payments/{purchaseid}/items . It adds the selected product as a item in given purchaseId in Avarda
update request is called -> Avarda API is sending request for update and it receives the correct amount in TotalPrice, which is "subtotal" + "selected shipping method price"
User refreshes the checkout -> The items are sent again to avarda but this time the qoute shipping is added as a item.
In result on the update request, the selected shipping price is added twice.
When I patched the code not to add a shipping as a item in the quote then it is working as expected:
-> when the shipping is already chosen and the user is refreshing the page - the amount is not increased by the additional shipping cost
-> when placing the order the "shipping item" is added.
My patch only commented this line as a workaround:
In other words the difference is on enter the checkout page, when the module is sending
PUT https://stage.checkout-api.avarda.com/api/partner/payments/{purchaseid}/items
If user is refreshing (or getting back to) the checkout page - the "shipping item" is added here
If the user is entering the checkout page the first time - only the product items are added to avarda with this PUT request
after the "1 point" scenario the "update" request to avarda is adding a selected shipping on top of already added items. So if you added one product and entered the checkout module twice you have 3 items in avarda purchase, from which 2 are shippings.
after the "2 point" scenario the "upfate" request is also adding a shipping method item but there is no extra item here.
Of course this is the case on the shipping broker variant.
I haven't had occasion to test it with the regular magento-defined delivery methods.
Using shipping broker as a delivery method source.
Scenario:
not logged in user is adding one (or more) product into the new cart -> a new guest cart is created with this product as a item
user goes to the cart, and goes to the avarda checkout -> user can see shipping methods. There is also a items call:
https://stage.checkout-api.avarda.com/api/partner/payments/{purchaseid}/items
. It adds the selected product as a item in given purchaseId in Avardaupdate request is called -> Avarda API is sending request for update and it receives the correct amount in TotalPrice, which is "subtotal" + "selected shipping method price"
User refreshes the checkout -> The items are sent again to avarda but this time the qoute shipping is added as a item.
In result on the update request, the selected shipping price is added twice.
When I patched the code not to add a shipping as a item in the quote then it is working as expected:
-> when the shipping is already chosen and the user is refreshing the page - the amount is not increased by the additional shipping cost
-> when placing the order the "shipping item" is added.
My patch only commented this line as a workaround:
Referring this line
https://github.com/avarda-ab/Magento2-Checkout-module/blame/3c99643f1b20a053c7240ac8b91cab1416dfaff0/Plugin/Model/Quote/QuoteCollectTotalsPrepareItems.php#L179
Is it necessary to add the "shipping item" from the cart shipping address in any case?
The text was updated successfully, but these errors were encountered: