ywgc_data is not defined
-
After 2.0.1 update, the plugin loads ywgc-frontend.js with the following line:
ln:20
datePicker.datepicker({dateFormat: ywgc_data.date_format, minDate: +1, maxDate: "+1Y"});
ywgc_data is not declared in all pages firing that error and blocking all javascript to work properly.
ywgc_data is declared in plugins/yith-woocommerce-gift-cards/lib/class-yith-ywgc-frontend.php but the function is loading the scripts on product, cart, checkout, and account_page. It also has a filter (yith_ywgc_do_eneuque_frontend_scripts) were you can force to always declare frontend scripts, but that’s not the best as there are locations where you don’t wan’t this.
Can you replace your script to check if variable ywgc_data is defined on ywgc-frontend.js before trying to use it?
The temporary fix for me is apply this filter, but, as I mentioned, not the best solution:
add_filter( 'yith_ywgc_do_eneuque_frontend_scripts', '__return_true' );
Thank you!!
- This topic was modified 5 years, 1 month ago by .
- This topic was modified 5 years, 1 month ago by .
- This topic was modified 5 years, 1 month ago by .
The page I need help with: [log in to see the link]
- The topic ‘ywgc_data is not defined’ is closed to new replies.