Magento – How to create Product list widget with owl carousel on Magento 2

javascriptjquerymagento2requirejswidgets

My steps:

  1. Copy magento-2-directory/magento/vendor/magento/module-catalog-widget/view/frontend/templates/product/widget/content/**grid.phtml** to magento-2-directory/app/design/frontend/Agestor/default/Magento_CatalogWidget/templates/product/widget/content/**grid.phtml**
    Directory
  2. Create requirejs-config.js to magento-2-directory/app/design/frontend/Agestor/default.
    requirejs-config.js
  3. Widjet not work and I have errors in consol.Widjet
    Errors

Best Answer

You have to just create requirejs-config.js at below location with code,

magento-2-directory/app/design/frontend/Agestor/default/Magento_CatalogWidget/requirejs-config.js

/**
 *  This is used for slider
 */
var config = {
    paths: {            
            'owlcarousel': "js/owl.carousel.min"
        },   
    shim: {
        'owlcarousel': {
            deps: ['jquery']
        }
    }
};

Run php bin/magento setup:static-content:deploy command and remove cache.