I am working on checkout page, I have pass some array values to checkout config provider.
How to get those values in knockout JS and display by knockout html.
Want to display all applied codes in checkout payment step.
I have passed values to config provider by below code
public function getConfig()
{
return $this->getAppliedGiftCards();
}
public function getAppliedGiftCards()
{
$quoteId = $this->checkoutSession->getQuote()->getId();
$giftcardCodes = $this->quoteFactory->getGiftCardCollection($quoteId);
$config = [];
foreach ($giftcardCodes as $giftcardCode){
$config['payment']['applied_giftcard'][$giftcardCode->getCode()] = $giftcardCode->getCode();
}
return $config;
}
Get values in Js by below code
var configValues = window.checkoutConfig.payment;
var applied_giftcard = ko.observable(configValues.applied_giftcard);
How to render passed config array value to knockout template.