Not displaying the correct row total in cart page
My vue storefront is not displaying the row total including tax when I have already set to display price including tax in magento configuration.
6 Replies
can you please add info if you're using SDK or VSF2. Also, can you please show me the code you use to display price and the response object you're receiving from Magento
Cart.vue is the code I am using to display cart item price.
message.txt is the response object I am receiving from magento , this should be the graphql query used: https://github.com/vuestorefront/magento2/blob/main/packages/api-client/src/api/customerCart/customerCart.ts
I am using VSF2.
GitHub
magento2/packages/api-client/src/api/customerCart/customerCart.ts a...
Vue Storefront 2 integration for Magento 2. Contribute to vuestorefront/magento2 development by creating an account on GitHub.
It is displaying row total instead of row total including tax
okay, I'm on it, brb
alright, in your store, please find
modules/checkout/getters/cartGetters,ts
- this is the file where getItemPrice
getter is declared. You will see that we return an object with different prices and one of them is total: total: product.prices?.row_total?.value,
. If you look at your response object, there is product.prices.row_total_including_tax
property.
You can add additional return value to getItemPrice
named totalWithTax: product.prices?.row_total_including_tax?.value
- and then replace $fc(cartGetters.getItemPrice(product).regular
- regular with totalWithTax
Let me know if that helpedAlright, it works. Thank you.
awesome 🙂 Marking as solved