Skip to content

Magento 2 override shipping file giving error of Invalid template file

We are using Magento 2.3.5 version when we are trying to override file of

vendor/magento/module-checkout/view/frontend/templates/cart/shipping.phtml

to

app/design/frontend/Infortis/base/Magento_Checkout/templates/cart/shipping.phtml

It showing error on browser console –

VM2090:4 [2023-11-27 11:58:20] [ERROR] Failed to load the "Magento_Checkout/js/view/cart/totals" component.
ConsoleOutputHandler.show @ VM2090:4
VM2090:4 [2023-11-27 11:58:20] [ERROR] Failed to load the "Magento_Checkout/js/view/summary/subtotal" component.
ConsoleOutputHandler.show @ VM2090:4
VM2090:4 [2023-11-27 11:58:20] [ERROR] Failed to load the "Magento_Checkout/js/view/cart/totals/shipping" component.
ConsoleOutputHandler.show @ VM2090:4
VM2090:4 [2023-11-27 11:58:20] [ERROR] Failed to load the "Magento_Checkout/js/view/summary/grand-total" component.
ConsoleOutputHandler.show @ VM2090:4
VM2090:4 [2023-11-27 11:58:20] [ERROR] Failed to load the "Magento_GiftMessage/js/view/gift-message" component.
ConsoleOutputHandler.show @ VM2090:4
VM2400:3 Uncaught TypeError: Cannot read properties of undefined (reading 'vertexAddressValidationConfig')
    at eval (eval at require.load (450855cf68a5a20828f86e62fff3e9c5.min.js:184:216), <anonymous>:3:117)
    at Object.execCb (450855cf68a5a20828f86e62fff3e9c5.min.js:112:132)
    at context.execCb (eval at require.load (450855cf68a5a20828f86e62fff3e9c5.min.js:184:216), <anonymous>:13:147)
    at Module.check (450855cf68a5a20828f86e62fff3e9c5.min.js:56:457)
    at Module.enable (450855cf68a5a20828f86e62fff3e9c5.min.js:73:285)
    at Module.init (450855cf68a5a20828f86e62fff3e9c5.min.js:54:144)
    at callGetModule (450855cf68a5a20828f86e62fff3e9c5.min.js:74:238)
    at Object.completeLoad (450855cf68a5a20828f86e62fff3e9c5.min.js:103:1)
    at require.load (450855cf68a5a20828f86e62fff3e9c5.min.js:184:245)
    at Object.load (450855cf68a5a20828f86e62fff3e9c5.min.js:112:49)
VM2412:3 Uncaught TypeError: Cannot read properties of undefined (reading 'bssOsc')
    at eval (eval at require.load (450855cf68a5a20828f86e62fff3e9c5.min.js:184:216), <anonymous>:3:119)
    at 450855cf68a5a20828f86e62fff3e9c5.min.js:191:119
    at Array.forEach (<anonymous>)
    at applyMixins (450855cf68a5a20828f86e62fff3e9c5.min.js:191:88)
    at 450855cf68a5a20828f86e62fff3e9c5.min.js:192:174
    at Object.execCb (450855cf68a5a20828f86e62fff3e9c5.min.js:112:132)
    at context.execCb (eval at require.load (450855cf68a5a20828f86e62fff3e9c5.min.js:184:216), <anonymous>:13:147)
    at Module.check (450855cf68a5a20828f86e62fff3e9c5.min.js:56:457)
    at Module.enable (450855cf68a5a20828f86e62fff3e9c5.min.js:73:285)
    at Module.init (450855cf68a5a20828f86e62fff3e9c5.min.js:54:144)
VM2118:18 Braintree Apple Pay is not supported on this device/browser
deviceSupported @ VM2118:18
VM2514:3 Uncaught TypeError: Cannot read properties of undefined (reading 'checkoutAgreements')
    at eval (eval at require.load (450855cf68a5a20828f86e62fff3e9c5.min.js:184:216), <anonymous>:3:87)
    at Object.execCb (450855cf68a5a20828f86e62fff3e9c5.min.js:112:132)
    at context.execCb (eval at require.load (450855cf68a5a20828f86e62fff3e9c5.min.js:184:216), <anonymous>:13:147)
    at Module.check (450855cf68a5a20828f86e62fff3e9c5.min.js:56:457)
    at Module.enable (450855cf68a5a20828f86e62fff3e9c5.min.js:73:285)
    at Module.init (450855cf68a5a20828f86e62fff3e9c5.min.js:54:144)
    at callGetModule (450855cf68a5a20828f86e62fff3e9c5.min.js:74:238)
    at Object.completeLoad (450855cf68a5a20828f86e62fff3e9c5.min.js:103:1)
    at require.load (450855cf68a5a20828f86e62fff3e9c5.min.js:184:245)
    at Object.load (450855cf68a5a20828f86e62fff3e9c5.min.js:112:49)

and in system.log file it is showing –

[2023-11-27 07:57:18] main.CRITICAL: Invalid template file: '/var/www/vhosts/xyz.com/httpdocs/var/view_preprocessed/pub/static/app/design/frontend/Infortis/base/Magento_Checkout/templates/cart/shipping.phtml' in module: 'Magento_Checkout' block's name: 'checkout.cart.shipping' [] []