Repository navigation
Keep WooSync's external store connections when WooCommerce is activated on the same site - #113
Draft
LiamSarsfield wants to merge 2 commits into
Draft
LiamSarsfield wants to merge 2 commits into
LiamSarsfield wants to merge 2 commits into
Conversation
…ed on the same site add_sync_site() read the saved store connections only when it had to generate a site key. Given a key, it saved a list holding just the new site. get_active_sync_sites() adds the local store that way when WooCommerce is active and no local entry is saved, so every remote connection and its sync progress was dropped and those stores stopped syncing. Read the saved connections before adding in both cases.
…r the WooCommerce-active read Woo Sync settings are also held in memory on the shared CRM settings object, which the database reset between tests does not clear, so the stores this test saved were still there for later tests. The test class now puts the list back in tear_down(). A second test reads the connections with WooCommerce marked active, the path that adds the local store on a live site, and checks the saved remote store is kept.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This stops WooSync from dropping saved external store connections when the local WooCommerce store is added.
What
Woo_Sync::add_sync_site()now reads the saved connections first. Before, only a call without a site key read them; a call with one saved only the new site.Why
get_active_sync_sites()adds the local store, keylocal, when WooCommerce is active and none is saved. On a site already syncing external stores, that call replaced the saved list: the external connections and their sync progress were lost, and those stores stopped syncing. Connecting another external store on a site running WooCommerce, before the local store was saved, lost the existing ones the same way.It ships in the next release for every site, with no option to turn it off.
Testing
Automated (run):
Sync_Sites_Test: with a synced external store saved, one test adds the local store directly, the other reads the connections with WooCommerce marked active. Both check the external store's entry is unchanged and fail without the fix.composer csis clean.By hand (not run):
Release Notes