Skip to content

fix: Make autocomplete sponsored ads opt-in instead of always-on - #244

Open
amandascm wants to merge 1 commit into
masterfrom
fix/autocomplete-sponsored-ads-opt-in
Open

fix: Make autocomplete sponsored ads opt-in instead of always-on#244
amandascm wants to merge 1 commit into
masterfrom
fix/autocomplete-sponsored-ads-opt-in

Conversation

@amandascm

Copy link
Copy Markdown

Summary

  • Autocomplete#updateProducts hardcoded showSponsored: true / sponsoredCount: 2 when calling BiggyClient.suggestionProducts. Any VTEX account linked to an ads publisher via PAI would start showing sponsored products in the native autocomplete, in any workspace (dev or prod), with no way to opt out.
  • showSponsored and sponsoredCount are now optional props on the autocomplete-result-list.v2 block, defaulting to false/2. Ads are now opt-in per block declaration, so each store theme/workspace controls whether sponsored products are requested — consistent with how other optional props (hideUnavailableItems, orderBy, ...) already work on this component.
  • Documented the two new props in docs/Autocomplete.md and added a CHANGELOG.md entry under [Unreleased].

Context

Root-caused after sponsored products appeared unexpectedly in the Auchan production store. The account had been linked to a publisher via PAI, and since the account↔publisher mapping isn't scoped by VTEX environment, ads could turn on in dev or prod as soon as that link exists — regardless of intent.

Test plan

  • CI Cypress (vtex/search-tests against the biggy account) passes.
  • CI lint workflow (vtex/action-lint) passes.
  • Manually verify: with no showSponsored prop set on autocomplete-result-list.v2, no advertisementOptions.showSponsored is sent as true to suggestionProducts.
  • Manually verify: setting "showSponsored": true (and optionally "sponsoredCount") on the block re-enables sponsored products as before.

🤖 Generated with Claude Code

`showSponsored`/`sponsoredCount` were hardcoded to `true`/`2` in
Autocomplete#updateProducts, so any VTEX account linked to an ads
publisher via PAI started showing sponsored products in the native
autocomplete with no way to opt out per environment. Both are now
block props (default `false`/`2`) so each store theme/workspace
controls ads independently.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@amandascm
amandascm requested review from a team as code owners August 13, 2026 18:48
@vtex-io-ci-cd

vtex-io-ci-cd Bot commented Aug 13, 2026

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 🤖

Thank you so much for keeping our documentation up-to-date ❤️

@chrsmutti chrsmutti left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

Wouldn't this change the already running accounts? Is it something for us to worry about?

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.

3 participants