Skip to content

fix: refactoring the logic of adding the subscriptionData#209

Open
juliabrzvtex wants to merge 2 commits into
vtex-apps:mainfrom
juliabrzvtex:patch-1
Open

fix: refactoring the logic of adding the subscriptionData#209
juliabrzvtex wants to merge 2 commits into
vtex-apps:mainfrom
juliabrzvtex:patch-1

Conversation

@juliabrzvtex

Copy link
Copy Markdown

What problem is this solving?

The current logic for adding subscription items to the cart had a bug in calculating the itemIndex when a promotion added a gift to the cart. Reordering the items array invalidated the previous index calculation, resulting in the subscription data being associated with the wrong item.

How should this be manually tested?

To check for the bug, add an item with a promotional offer to the cart and then try adding an item with a subscription. When checking the subscriptionData field, no information will be provided regarding the latter item.

Fix tested in this workspace: https://testvtex--clubsoftysb2c.myvtex.com/jabon-barra-elite-humectante-pack-3-un/p

Type of changes

✔️ Type of Change
✔️ Bug fix
_ New feature
_ Breaking change
_ Technical improvements

@juliabrzvtex juliabrzvtex requested a review from a team as a code owner September 17, 2025 12:56
@vtex-io-ci-cd

vtex-io-ci-cd Bot commented Sep 17, 2025

Copy link
Copy Markdown

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

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 🎉🎉

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant