Title: JavaScript errors when displaying products
Last modified: December 8, 2021

---

# JavaScript errors when displaying products

 *  [gavin310](https://wordpress.org/support/users/gavin310/)
 * (@gavin310)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/javascript-errors-when-displaying-products/)
 * I installed the latest version of WP Shopify today. I’m trying to display products
   using both the default “WP Shopify Products” page as well as my own page with
   the “[wps_products]” shortcode. It displays “Loading component …” and gives the
   following JavaScript error:
 *     ```
       Uncaught TypeError: Cannot read properties of undefined (reading 'createContext')
           at Object.../../../../../devil/devilbox-new/data/www/wpshopify-components/components/cart/_state/context.js (public.73ad37.min.js?ver=5.8.2:1)
           at i (runtime.73ad37.min.js?ver=5.8.2:1)
           at Object.../../../../../devil/devilbox-new/data/www/wpshopify-components/common/hooks/index.js (public.73ad37.min.js?ver=5.8.2:1)
           at i (runtime.73ad37.min.js?ver=5.8.2:1)
           at Object.../../../../../devil/devilbox-new/data/www/wpshopify-components/index.js (public.73ad37.min.js?ver=5.8.2:1)
           at i (runtime.73ad37.min.js?ver=5.8.2:1)
           at Object../_tmp/public/js/app/app.js (public.73ad37.min.js?ver=5.8.2:1)
           at i (runtime.73ad37.min.js?ver=5.8.2:1)
           at t (public.73ad37.min.js?ver=5.8.2:1)
           at public.73ad37.min.js?ver=5.8.2:1
       ```
   
 * Any idea how I can fix this?

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [gavin310](https://wordpress.org/support/users/gavin310/)
 * (@gavin310)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/javascript-errors-when-displaying-products/#post-15147082)
 * I tracked it down to this line in the theme:
 * `wp_add_inline_script( 'global', 'var wp = { siteRoot: "' . get_site_url() . '",
   templateDir: "' . get_stylesheet_directory_uri() . '", pluginsDir: "' . plugins_url().'",
   ajaxURL: "' . admin_url( 'admin-ajax.php' ) . '" };', true );`
    -  This reply was modified 4 years, 5 months ago by [gavin310](https://wordpress.org/support/users/gavin310/).
 *  Plugin Author [andrewmrobbins](https://wordpress.org/support/users/andrewmrobbins/)
 * (@andrewmrobbins)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/javascript-errors-when-displaying-products/#post-15152816)
 * [@gavin310](https://wordpress.org/support/users/gavin310/)
 * Hey there,
 * What did you change within that code to fix it?

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘JavaScript errors when displaying products’ is closed to new replies.

 * ![](https://ps.w.org/wpshopify/assets/icon.svg?rev=2740857)
 * [ShopWP](https://wordpress.org/plugins/wpshopify/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wpshopify/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wpshopify/)
 * [Active Topics](https://wordpress.org/support/plugin/wpshopify/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wpshopify/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wpshopify/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [andrewmrobbins](https://wordpress.org/support/users/andrewmrobbins/)
 * Last activity: [4 years, 5 months ago](https://wordpress.org/support/topic/javascript-errors-when-displaying-products/#post-15152816)
 * Status: not resolved