-
Notifications
You must be signed in to change notification settings - Fork 67
Description
Describe the bug:
I didn't find any specific bug, but I see a chance for such :)
The review of #400 revealed that the maybe_set_defaults function introduced in 2.0.0 breaks the behavior of WC_Integration::init_settings.
If the extension (2.0.0+) is newly activated - meaning there were no settings yet. It saves the settings with a single property set 'ga_product_identifier' => 'product_id'. Then, when the WC_Google_Analytics constructor is called, the `init_settings, which is supposed to set all the defaults to what's defined in the form fields, does nothing, as it finds that the settings object is already set.
Steps to reproduce:
- Deactivate, uninstall GA4W.
- Remove
woocommerce_google_analytics_settingsentry fromwp_options - Install and activate using CLI
wp plugin install woocommerce-google-analytics-integration
wp plugin activate woocommerce-google-analytics-integration- Visit any page as a guest.
Expected behavior:
woocommerce_google_analytics_settings settings should contain all the defaults
Actual behavior:
woocommerce_google_analytics_settings has only ga_product_identifier set.
Additional details:
Maybe it's not a bug, but the desired effect, but I find it confusing and bug-prone to have two sets of defaults.