Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove options remapping, use settings directly. #360

Merged
merged 4 commits into from
Mar 1, 2024

Conversation

tomalec
Copy link
Member

@tomalec tomalec commented Feb 26, 2024

⚠️ This PR requires #328

Changes proposed in this Pull Request:

I don't see any value in having another layer that's just a copy of the existing ->settings. Having three places to store the same thing may lead to more bugs like #359, where the objects get out of sync.

Checks:

  • Does your code follow the WordPress coding standards?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully run tests with your changes locally?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

Screenshots:

Detailed test instructions:

  1. Go to WooCommerce > Settings > Integration > Google Analytics wp-admin/admin.php?page=wc-settings&tab=integration&section=google_analytics
  2. Make sure " Purchase Transactions" is checked
  3. Check the value of all the settings match the tracker data
    wp wc tracker snapshot --format=json | jq '.[0]["wc-google-analytics"]' 
    
  4. Check that wcgaiData.config matches the settings
  5. Smoke test the plugin

Additional details:

  1. I think we can consider one more tweak: removing the static get function and using the settings array directly. A static function that relies on the property set by the instance constructor looks bug-prone. Plus, defining a function to do $this->get( 'foo' ) instead of $this->settings['foo'], makes the code less explicit and does not bring much value IMO

Changelog entry

Dev - Remove options remapping, use settings directly.

@tomalec tomalec requested review from martynmjones and a team February 26, 2024 18:51
@tomalec tomalec self-assigned this Feb 26, 2024
@github-actions github-actions bot added the changelog: dev Developer-facing only change. label Feb 26, 2024
Base automatically changed from update/tracking-for-classic-pages to remove-universal-analytics February 27, 2024 17:11
Copy link
Contributor

@martynmjones martynmjones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @tomalec, thanks for tidying up the extension settings 🙌

Tracking is working as expected and the correct events are being loaded into the wcgaiData object so LGTM ✅

@tomalec tomalec merged commit f92124b into remove-universal-analytics Mar 1, 2024
5 checks passed
@tomalec tomalec deleted the dev/refactor-options branch March 1, 2024 16:47
@jorgemd24 jorgemd24 mentioned this pull request Mar 5, 2024
19 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: dev Developer-facing only change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants