Hi guys I want to override klavio php file. My main purpose is make it checkbox default as checked. Now is default False.
Current File:
vendor>klavio>magento2-extention>Plugin>CheckoutLayoutPlugin.php
How can I Override This file on magento 2.3.3
namespace KlaviyoReclaimPlugin;
use KlaviyoReclaimHelperScopeSetting;
class CheckoutLayoutPlugin
{
public function __construct(
ScopeSetting $klaviyoScopeSetting
) {
$this->_klaviyoScopeSetting = $klaviyoScopeSetting;
}public function afterProcess(MagentoCheckoutBlockCheckoutLayoutProcessor $processor, $jsLayout) { if ($this->_klaviyoScopeSetting->getConsentAtCheckoutSMSIsActive()) { $smsConsentCheckbox = [ 'component' => 'Magento_Ui/js/form/element/abstract', 'config' => [ 'customScope' => 'shippingAddress.custom_attributes', 'template' => 'ui/form/field', 'elementTmpl' => 'ui/form/element/checkbox', 'options' => [], 'id' => 'kl_sms_consent', ], 'dataScope' => 'shippingAddress.custom_attributes.kl_sms_consent', 'label' => $this->_klaviyoScopeSetting->getConsentAtCheckoutSMSConsentLabelText(), 'description' => $this->_klaviyoScopeSetting->getConsentAtCheckoutSMSConsentText(), 'provider' => 'checkoutProvider', 'visible' => true, 'checked' => false, 'validation' => [], 'sortOrder' => $this->_klaviyoScopeSetting->getConsentAtCheckoutSMSConsentSortOrder(), 'id' => 'kl_sms_consent', ]; $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']['shippingAddress']['children']['shipping-address-fieldset']['children']['kl_sms_consent'] = $smsConsentCheckbox; } // Open to ideas here, since we don't overwrite the customer-email section // we need to distinguish if the customer is logged in or not, object manager is an easy way to do so $objectManager = MagentoFrameworkAppObjectManager::getInstance(); $customerSession = $objectManager->get('MagentoCustomerModelSession'); if (!$customerSession->isLoggedIn() && $this->_klaviyoScopeSetting->getConsentAtCheckoutEmailIsActive()) { $emailConsentCheckbox = [ 'component' => 'Magento_Ui/js/form/element/abstract', 'config' => [ 'customScope' => 'shippingAddress.custom_attributes', 'template' => 'ui/form/field', 'elementTmpl' => 'ui/form/element/checkbox', 'options' => [], 'id' => 'kl_email_consent', ], 'dataScope' => 'shippingAddress.custom_attributes.kl_email_consent', 'description' => $this->_klaviyoScopeSetting->getConsentAtCheckoutEmailText(), 'provider' => 'checkoutProvider', 'visible' => true, 'checked' => false, <<<<<<------ I WANT TO CHANGE HERE AS LIKE "TRUE" 'validation' => [], 'sortOrder' => $this->_klaviyoScopeSetting->getConsentAtCheckoutEmailSortOrder(), 'id' => 'kl_email_consent', ]; $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']['shippingAddress']['children']['shipping-address-fieldset']['children']['kl_email_consent'] = $emailConsentCheckbox; } return $jsLayout; }
}
Same other topic but not resolved