Skip to content

fix: use PATCH instead of PUT when updating clientPreferences (Profile System V2)#698

Merged
iago1501 merged 1 commit into
masterfrom
fix/purchase-info-patch-instead-of-put
Jun 19, 2026
Merged

fix: use PATCH instead of PUT when updating clientPreferences (Profile System V2)#698
iago1501 merged 1 commit into
masterfrom
fix/purchase-info-patch-instead-of-put

Conversation

@iago1501

@iago1501 iago1501 commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Problem

When a user updates their newsletter preferences (updatePersonalPreferences), store-graphql was calling PUT /purchase-info sending only the clientPreferences payload. Because PUT replaces the entire entity, the paymentData field (saved cards) was being wiped from the user's profile.

This was identified as the root cause of a production incident where transactions were being cancelled via the WorldpayVTEX connector: the gatewayCallback validation was failing because the saved card appeared to belong to a "loaded profile" (no login), since the card data had been removed from the real profile after the PUT.

The Storage team blocked external write access to purchase-info as a mitigation, and this PR addresses the same issue at the store-graphql level.

Fix

Changed this.putthis.patch in updatePersonalPreferences (profileV2.ts:133).

PATCH performs a partial update, merging only clientPreferences into the existing document and leaving paymentData intact.

No other calls to purchase-info in this codebase use PUT — the V1 client uses POST /personalPreferences/ (a different endpoint) and is not affected.

…ile System V2

PUT was overwriting the entire purchase-info entity with only clientPreferences data,
wiping paymentData (saved cards) from the user profile.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@iago1501 iago1501 requested a review from a team as a code owner June 17, 2026 15:30
@iago1501 iago1501 requested review from leo-prange-vtex, mendescamara and vmourac-vtex and removed request for a team June 17, 2026 15:30
@vtex-io-ci-cd

vtex-io-ci-cd Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Hi! I'm VTEX IO CI/CD Bot and I'll be helping you to publish your app! 🤖

Please select which version do you want to release:

  • Patch (backwards-compatible bug fixes)

  • Minor (backwards-compatible functionality)

  • Major (incompatible API changes)

And then you just need to merge your PR when you are ready! There is no need to create a release commit/tag.

  • No thanks, I would rather do it manually 😞

@vtex-io-docs-bot

vtex-io-docs-bot Bot commented Jun 17, 2026

Copy link
Copy Markdown

Beep boop 🤖

I noticed you didn't make any changes at the docs/ folder

  • There's nothing new to document 🤔
  • I'll do it later 😞

In order to keep track, I'll create an issue if you decide now is not a good time

  • I just updated 🎉🎉

@iago1501 iago1501 requested review from monteirogc and vsseixaso and removed request for leo-prange-vtex and mendescamara June 17, 2026 15:30
@iago1501 iago1501 self-assigned this Jun 17, 2026
@iago1501 iago1501 added the bug label Jun 17, 2026

@wisneycardeal wisneycardeal left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

That change was aligned during the #inc-5621.
This point is encapsulated in a method that maintains the same signature.
So LGTM.

@iago1501 iago1501 merged commit 5aee121 into master Jun 19, 2026
9 of 10 checks passed
@iago1501 iago1501 deleted the fix/purchase-info-patch-instead-of-put branch June 19, 2026 13:48
@vtex-io-ci-cd

vtex-io-ci-cd Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Your PR has been merged! App is being published. 🚀
Version 2.177.2 → 2.177.3

After the publishing process has been completed (check #vtex-io-releases) and doing A/B tests with the new version, you can deploy your release by running:

vtex deploy vtex.store-graphql@2.177.3

After that your app will be updated on all accounts.

For more information on the deployment process check the docs. 📖

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants