How to put module enable condition in checkout_index_index.xml ?

Loading...
How to put module enable condition in checkout_index_index.xml ?

Using this plugin you can disable checkout xml component

1.) Add this plugin at etc/frontend/di.xml

2.) Create Disable file at path Vendor\Module\Plugin

namespace Vendor\Module\Plugin;

use Magento\Checkout\Block\Checkout\LayoutProcessor;

class Disable {

protected $helper;

public function __construct(

\Vendor\Module\Helper\Data $helper

) {

$this->helper = $helper;

}

public function afterProcess(

LayoutProcessor $processor,

array $jsLayout

){

$enable = $this->helper->getConfig(module/general/enable');

if($enable == 0)

{

//Here put Your condition $jsLayout['components']['checkout']['children']['steps'] ['children']['billing-step']['children']['payment']['children']['afterMethods']['children']['credit']['config']['compone ntDisabled'] = true;

}

return $jsLayout;

}

}



Copyright © 2024 Tridhya Tech Limited, Inc. All rights reserved.