Skip to content

Magento 2.4.7 3rd party scrpit is not working on checkout page

Error Screenshot: https://prnt.sc/evsXGmA4rOdW

  <?php
    $googlehelper = $this->helper('ModuleExtensionHelperData');
    $isenabled = $googlehelper->isEnabled();
    if($isenabled) :
        $lanselected = $googlehelper->SelectLanguage();
        $layoutselected = $googlehelper->SelectLayout();
        $bashlanguage = substr($googlehelper->BashLanguage(), 0, 2);
        $layouthtml = 'layout: google.translate.TranslateElement.InlineLayout.'.$layoutselected; ?>
    
        <div id="google_translate_element" style="float: left;"></div>
      
    
              <?php $scriptString = <<<script
             function googleTranslateElementInit()
                {
                    new google.translate.TranslateElement(
                        {
                            pageLanguage: 'zu',
                            includedLanguages: '{$googlehelper->SelectLanguage()}',
                             layout:'{$googlehelper->SelectLayout()}'
                        },
                        'google_translate_element');
                }
                
    script;
        ?>    
        <?= /* @noEscape */ $secureRenderer->renderTag('script', [], $scriptString, false) ?>
    
    <script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
    
    <?php endif; ?>