Skip to content

Fixing scenario where false unavailable items are show on ReviewBlock#184

Open
wender wants to merge 2 commits into
masterfrom
bugfix/B2BTEAM-3293_show-available-sellers
Open

Fixing scenario where false unavailable items are show on ReviewBlock#184
wender wants to merge 2 commits into
masterfrom
bugfix/B2BTEAM-3293_show-available-sellers

Conversation

@wender

@wender wender commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

What does this PR do?

Fixes seller resolution in ReviewBlock during refId validation (Copy/Paste and Upload flows).

Problem: After skuFromRefIds, seller data was taken from mappedRefId, which was only filled for items found in the autocomplete restriction check. When an item was missing from that map, the UI got:

  • empty rowData.sellers → no seller dropdown even when the API returned multiple sellers
  • empty sellerWithStock → false "Restricted Item" even when stock existed on another seller

This showed up in stores with multiple sellers per SKU (e.g. default seller "1" without stock + marketplace seller "cromosolsc1" with stock on sales channel 4).

Solution:

  • Build seller data from the skuFromRefIds API response (refIdApiMap)
  • Auto-select the first seller with available or partiallyAvailable stock
  • Use that seller for vtexSku, unitMultiplier, and availableQuantity
  • Remove unused setRestriction / checkRestriction autocomplete logic that fed the broken mappedRefId flow

How to test it?

Workspace

Example: RefId 1006 → SKU 12250, sellers "1" (withoutStock) and "cromosolsc1" (available).

  1. Open Quick Order and paste/upload a line with the refId (e.g. 1006,1).
  2. Wait for validation to finish.
  3. Expected:
    • Status is Valid (not "Restricted Item")
    • Seller column shows a dropdown with both sellers (seller without stock excluded from options)
    • Default selection is the seller with stock (cromosolsc1 / CROMOSOL)
  4. Change seller in the dropdown and confirm status/quantity update for the selected seller.
  5. Regression: single-seller SKU still shows the seller name (no dropdown) and validates correctly.
  6. Regression: refId not found → SKU not found; SKU with no available sellers → Without stock.

Optional: In devtools, confirm skuFromRefIds returns multiple sellers and the review row has sellers.length > 1 and a resolved seller.

Screenshots

Before:
image

After:
image

image

@vtex-io-ci-cd

vtex-io-ci-cd Bot commented Jun 25, 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 🤖

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.

2 participants