Skip to content

Conversation

@joshheald
Copy link
Contributor

Merge after: #16322

Description

This PR fixes an issue with incremental sync

Previously, if variations changed, any unchanged variations for the same product would be deleted during an incremental sync.

This was because we also get the parent product back, and we used insert(onConflict: .replace) – this triggered a cascade delete of variations (and other relations.)

Then we inserted the changed variations, so any that were unchanged remained deleted.

To avoid these issues, we move to save, which is GRDB’s upsert method.

Additionally, with the fix deleted variations would not be deleted during an incremental sync. To improve that, we check the variationIDs array for which variations to leave in, after an incremental sync.

Test Steps

  1. Perform a full sync

  2. Open POS, open variable product, confirm all the variations show up

  3. Go to wp-admin, update the price of a single variation

  4. Pull to Refresh to perform an incremental sync

  5. Observe that all the variations are shown (including the updates.)

  6. Delete a variation on the web

  7. Pull to refresh

  8. Observe that the variation is deleted.


  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

This commit fixes an issue with incremental sync

Previously, if variations changed, any unchanged variations for the same product would be deleted during an incremental sync.

This was because we also get the parent product back, and we used `insert(onConflict: .replace)` – this triggered a cascade delete of variations (and other relations.)

Then we inserted the changed variations, so any that were unchanged remained deleted.

To avoid these issues, we move to `save`, which is GRDB’s upsert method.

Additionally, with the fix deleted variations would not be deleted during an incremental sync. To improve that, we check the `variationIDs` array for which variations to leave in, after an incremental sync.
@joshheald joshheald added this to the 23.7 milestone Nov 6, 2025
@joshheald joshheald added type: task An internally driven task. feature: POS labels Nov 6, 2025
@joshheald joshheald changed the base branch from trunk to issue/woomob-1224-use-variations-endpoint-for-incremental-sync November 6, 2025 15:10
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Nov 6, 2025

App Icon📲 You can test the changes from this Pull Request in WooCommerce iOS Prototype by scanning the QR code below to install the corresponding build.

App NameWooCommerce iOS Prototype
Build Numberpr16323-085214a
Version23.6
Bundle IDcom.automattic.alpha.woocommerce
Commit085214a
Installation URL2uvkuvv6js0jg
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@joshheald joshheald changed the title [Local catalog] Incremental update removes all variations [Local catalog] Retain unchanged variations during incremental sync Nov 6, 2025
@iamgabrielma iamgabrielma self-assigned this Nov 7, 2025
Copy link
Contributor

@iamgabrielma iamgabrielma left a comment

Choose a reason for hiding this comment

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

Worked great! 🚢

✅ Perform a full sync -> Open POS, open variable product, confirm all the variations show up

✅ Go to wp-admin, update the price of a single variation -> Pull to Refresh to perform an incremental sync -> Observe that all the variations are shown (including the updates.)

✅ Delete a variation on the web -> Pull to refresh -> Observe that the variation is deleted.

Base automatically changed from issue/woomob-1224-use-variations-endpoint-for-incremental-sync to trunk November 7, 2025 04:24
@joshheald joshheald enabled auto-merge November 7, 2025 04:24
@joshheald joshheald merged commit b86ecd7 into trunk Nov 7, 2025
15 checks passed
@joshheald joshheald deleted the woomob-1546-woo-poslocal-catalog-incremental-update-removes-all-product branch November 7, 2025 04:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: POS type: task An internally driven task.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants