0

I need to display a country list with dropdown in the custom knockout HTML template. Help would be appreciated.

1

With reference to this answer.

Magento already provide some inbuilt solution for this.

<?php $countryBlock = $block->getLayout()->createBlock('Magento\Directory\Block\Data');?>

<?= $countryBlock->getCountryHtmlSelect($defValue = null, $name = 'country_id', $id = 'country', $title = 'Country');?>

You can set default $defValue,$name,$id as per as your wise.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.