2

How do I fix Magento 2.2.2

Cannot Read Property “quoteData” of undefined

Issue? Please give me flexible solution for this issue.

1

1 Answer 1

0

It is almost impossible to identify the source of this error based just on this message. Most likely you are overriding/extending (mixin) some file, which being called on page where it is not intended.

Maybe instead of declaring some of your js library at requirejs, put in view/frontent/templates, as an example bellow.

<?php
$displayOnThisPage = $block->someFunctionWhichReturnsTrueFalse();

?>
<?php if ($block->isCheckoutPage()): ?>
<!--- some html if this is checkout page --->
<?php endif; ?>

<?php if ($displayOnThisPage ): ?>
    <script>
        require.config({
            config: {
                mixins: {
                    'Magento_Ui/js/lib/validation/validator': {
                        'Vendor_Module/js/validator-mixin': true
                    }
                }
            },
            map: {
                "*": {}
            }
        });
    </script>
    <script type="text/x-magento-init">
        {
            "*": {
            <?php if ($block->isCheckoutPage()): ?>

            <?php else: ?>

            <?php endif; ?>
            }
        }
    </script>
<?php endif; ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.