Skip to content
This repository has been archived by the owner on Mar 17, 2022. It is now read-only.

jQuery Migrate: jQuery.parseJSON requires a valid JSON string #522

Closed
webappvicio opened this issue Dec 28, 2020 · 2 comments
Closed

jQuery Migrate: jQuery.parseJSON requires a valid JSON string #522

webappvicio opened this issue Dec 28, 2020 · 2 comments

Comments

@webappvicio
Copy link

woo-poly-integration/public/js/Cart.min.js
jQuery.parseJSON requires a valid JSON string

Line 143 (Cart.js)
var wc_fragments = $.parseJSON( sessionStorage.getItem( wc_cart_fragments_params.fragment_name ) )

How I can fix the code to avoid the deprecation warning?

jQuery Migrate Version 2.62, WooCommerce 4.8.0, WordPress 5.6, Polylang (free) Version 2.9.1

@mrleemon
Copy link
Contributor

Try replacing that line with:

var wc_fragments = JSON.parse( sessionStorage.getItem( wc_cart_fragments_params.fragment_name ) );

@Jon007 Jon007 closed this as completed in 69ebadd Feb 3, 2021
@mrleemon
Copy link
Contributor

mrleemon commented Feb 4, 2021

@Jon007 You forgot to make the change in the Cart.min.js file, which is the one that is actually used in the plugin.

Jon007 added a commit that referenced this issue Feb 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants