We have an extension that has a block class that implements the \Magento\Checkout\Block\Checkout\LayoutProcessorInterface

I need to add a custom field in checkout so I created my own plugin of Magento\Checkout\Block\Checkout\LayoutProcessor which works as expected.

But when I create a plugin of the LayoutProcessor class of the extension, it doesn't work. I can't see my custom field. But it should work right? As the class extension is implementing the LayoutProcessorInterface

Now my question is why is my plugin not working,when the class implements the LayoutProcessorInterface?

1 Answer 1


Try this format


<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Checkout\Block\Checkout\LayoutProcessor">
    <plugin name="custom-checkout" type="Namespace\Module\Plugin\PluginName" sortOrder="10"/>


namespace Module\Namespace\Plugin;
class PluginName
    public function afterProcess(\Magento\Checkout\Block\Checkout\LayoutProcessor $processor, $jsLayout){

    $test = 'test';

    $newField = [
        'component' => 'Magento_Ui/js/form/element/abstract',
        'config' => [
            'customScope' => 'shippingAddress.custom_attributes',
            'customEntry' => null,
            'template' => 'ui/form/field',
            'elementTmpl' => 'ui/form/element/input',
            'tooltip' => [
                'description' => 'description'
        'dataScope' => 'shippingAddress.custom_attributes.' . $test,
        'label' => 'Custom Label',
        'provider' => 'checkoutProvider',
        'sortOrder' => 0,
        'validation' => [
            'required-entry' => true
        'options' => [],
        'filterBy' => null,
        'customEntry' => null,
        'visible' => true

    $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']['shippingAddress']['children']['shipping-address-fieldset']['children'][$test2] = $newField;

    return $jsLayout;

To extend the private method Event-Observer should be used

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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