Skip to main content

I need to change the Terms and Conditions htmlHTML. ClientThe client wants to add htmlHTML in the middle of the text. For that I need to change the getAgreementsConfig getAgreementsConfig function (Magento\CheckoutAgreements\Model\AgreementsConfigProviderMagento\CheckoutAgreements\Model\AgreementsConfigProvider).

I build a plugin to change the result of this function. I worked on this for the last 2 days, and no result until now. I don't know what else to do. My code is: My di.xmldi.xml file is:

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
    <type name="Magento\CheckoutAgreements\Model\AgreementsConfigProvider">
      <plugin name="agreementsHtmlText" type="VendorName\CheckoutAgreements\Model\Plugin\AgreementPlugin" sortOrder="10" disabled="false"/>
    </type>
</config>

And my Plugin is (VendorName\CheckoutAgreements\Model\Plugin\AgreementPluginVendorName\CheckoutAgreements\Model\Plugin\AgreementPlugin):

<?php

namespace VenderName\CheckoutAgreements\Model\Plugin;

use Magento\Checkout\Model\ConfigProviderInterface;
use Magento\Framework\App\ObjectManager;
use Magento\Store\Model\ScopeInterface;
use Magento\CheckoutAgreements\Model\Api\SearchCriteria\ActiveStoreAgreementsFilter;

class AgreementPlugin
{

    public function afterGetAgreementsConfig(\Magento\CheckoutAgreements\Model\AgreementsConfigProvider $subject, $result){

        foreach ($result['agreements'] as $key => $value) {
            $result[$key]['checkboxText'] ='ahahahhah'; // test if result changes
        }


        return 'qiweoqiwueioqwiueioquw'; //just to test if it changes the resukt
    }
}

I tried and change almost everything, and until now, no luck. Can anyone help me?

Thank you

I need to change the Terms and Conditions html. Client wants to add html in the middle of the text. For that I need to change the getAgreementsConfig function (Magento\CheckoutAgreements\Model\AgreementsConfigProvider).

I build a plugin to change the result of this function. I worked on this for the last 2 days, and no result until now. I don't know what else to do. My code is: My di.xml file is:

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
    <type name="Magento\CheckoutAgreements\Model\AgreementsConfigProvider">
      <plugin name="agreementsHtmlText" type="VendorName\CheckoutAgreements\Model\Plugin\AgreementPlugin" sortOrder="10" disabled="false"/>
    </type>
</config>

And my Plugin is (VendorName\CheckoutAgreements\Model\Plugin\AgreementPlugin):

<?php

namespace VenderName\CheckoutAgreements\Model\Plugin;

use Magento\Checkout\Model\ConfigProviderInterface;
use Magento\Framework\App\ObjectManager;
use Magento\Store\Model\ScopeInterface;
use Magento\CheckoutAgreements\Model\Api\SearchCriteria\ActiveStoreAgreementsFilter;

class AgreementPlugin
{

    public function afterGetAgreementsConfig(\Magento\CheckoutAgreements\Model\AgreementsConfigProvider $subject, $result){

        foreach ($result['agreements'] as $key => $value) {
            $result[$key]['checkboxText'] ='ahahahhah'; // test if result changes
        }


        return 'qiweoqiwueioqwiueioquw'; //just to test if it changes the resukt
    }
}

I tried and change almost everything, and until now, no luck. Can anyone help me?

Thank you

I need to change the Terms and Conditions HTML. The client wants to add HTML in the middle of the text. For that I need to change the getAgreementsConfig function (Magento\CheckoutAgreements\Model\AgreementsConfigProvider).

I build a plugin to change the result of this function. I worked on this for the last 2 days, and no result until now. I don't know what else to do. My code is: My di.xml file is:

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
    <type name="Magento\CheckoutAgreements\Model\AgreementsConfigProvider">
      <plugin name="agreementsHtmlText" type="VendorName\CheckoutAgreements\Model\Plugin\AgreementPlugin" sortOrder="10" disabled="false"/>
    </type>
</config>

And my Plugin is (VendorName\CheckoutAgreements\Model\Plugin\AgreementPlugin):

<?php

namespace VenderName\CheckoutAgreements\Model\Plugin;

use Magento\Checkout\Model\ConfigProviderInterface;
use Magento\Framework\App\ObjectManager;
use Magento\Store\Model\ScopeInterface;
use Magento\CheckoutAgreements\Model\Api\SearchCriteria\ActiveStoreAgreementsFilter;

class AgreementPlugin
{

    public function afterGetAgreementsConfig(\Magento\CheckoutAgreements\Model\AgreementsConfigProvider $subject, $result){

        foreach ($result['agreements'] as $key => $value) {
            $result[$key]['checkboxText'] ='ahahahhah'; // test if result changes
        }


        return 'qiweoqiwueioqwiueioquw'; //just to test if it changes the resukt
    }
}

I tried and change almost everything, and until now, no luck. Can anyone help me?

Thank you

Source Link
mvistas
  • 531
  • 4
  • 10

Need to change terms and conditions html, used a plugin, but is not working

I need to change the Terms and Conditions html. Client wants to add html in the middle of the text. For that I need to change the getAgreementsConfig function (Magento\CheckoutAgreements\Model\AgreementsConfigProvider).

I build a plugin to change the result of this function. I worked on this for the last 2 days, and no result until now. I don't know what else to do. My code is: My di.xml file is:

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
    <type name="Magento\CheckoutAgreements\Model\AgreementsConfigProvider">
      <plugin name="agreementsHtmlText" type="VendorName\CheckoutAgreements\Model\Plugin\AgreementPlugin" sortOrder="10" disabled="false"/>
    </type>
</config>

And my Plugin is (VendorName\CheckoutAgreements\Model\Plugin\AgreementPlugin):

<?php

namespace VenderName\CheckoutAgreements\Model\Plugin;

use Magento\Checkout\Model\ConfigProviderInterface;
use Magento\Framework\App\ObjectManager;
use Magento\Store\Model\ScopeInterface;
use Magento\CheckoutAgreements\Model\Api\SearchCriteria\ActiveStoreAgreementsFilter;

class AgreementPlugin
{

    public function afterGetAgreementsConfig(\Magento\CheckoutAgreements\Model\AgreementsConfigProvider $subject, $result){

        foreach ($result['agreements'] as $key => $value) {
            $result[$key]['checkboxText'] ='ahahahhah'; // test if result changes
        }


        return 'qiweoqiwueioqwiueioquw'; //just to test if it changes the resukt
    }
}

I tried and change almost everything, and until now, no luck. Can anyone help me?

Thank you