Magento 2 – Adding Custom Information to Checkout Order Summary

frontendknockoutjsmagento2

I'm working on my first Magento 2 project, and I'm slowly getting to grips with how everything works.

Then, I reach the point where I need to customize the checkout page and it throws a massive curveball, replacing the phtml/XML template system I've gotten used to with a completely different Knockout one.

In a nutshell, I store some personalization data in the quote item's "additional_data" field, and I need to show it in the checkout order summary.

I have successfully overridden /frontend/web/template/summary/item/details.html with my own custom template, but I have no idea how to get the data from the product object and display it using Knockout.

Has anyone done anything similar they wish to share to get me started?

Best Answer

You should be able to access the quote's 'additional data' here: window.checkoutConfig.quoteItemData[0].additional_data

So in your knockout template, you might have something like this:

<span data-bind="text: window.checkoutConfig.quoteItemData[0].additional_data"></span>
Related Topic