On the checkout page I want to add a radio button group with these options:
- Individual
- Company
Based on these options additional fields will be show. How can I add a radio button group to the checkout page?
I already created an InstallData.php file that can add fields:
/**
* Installs DB schema for a module
*
* @param ModuleDataSetupInterface $setup
* @param ModuleContextInterface $context
*
* @return void
*/
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
$setup->startSetup();
/** @var CustomerSetup $customerSetup */
$customerSetup = $this->customerSetupFactory->create([ 'setup' => $setup ]);
// Todo: add Radio button group
}
I already inserted other fields with this function, but I cannot find out how to add a radio button group.
Best Answer
This can be accomplished with a layoutproccessor, create it in your di.xml
and your layoutprocessor
Your Namespace_Module/js/view/form/element/radio.js file:
And your Namespace_Module/form/element/radio.html :