Skip to content

Fix store resolution on multi-store headless Adobe Commerce setups (REVIEWS-4382)#68

Draft
calsmith99 wants to merge 1 commit into
masterfrom
fix/REVIEWS-4382-multi-store-scope-id
Draft

Fix store resolution on multi-store headless Adobe Commerce setups (REVIEWS-4382)#68
calsmith99 wants to merge 1 commit into
masterfrom
fix/REVIEWS-4382-multi-store-scope-id

Conversation

@calsmith99

Copy link
Copy Markdown

Summary

  • Pass $scopeId to getStore($scopeId) in UpdateProductFeed::execute() so URL resolution uses config scope rather than the admin HTTP hostname
  • Replace $_SERVER['HTTP_HOST'] with $this->storeModel->getStore($scopeId)->getBaseUrl() so integration/app-installed receives the correct storefront URL, not the admin backend hostname
  • Defer getStore() in Api constructor — store StoreManagerInterface instead of eagerly calling getStore() at DI injection time, which threw when no store view matched the admin URL

Root cause

On single-instance multi-tenant Adobe Commerce setups, the admin backend URL (mcprod.smokemart.com.au) is not registered as a store view. Magento's StoreManager::getStore() with no argument tries to resolve the current store from the HTTP hostname — finding no match, it throws "The store that was requested wasn't found."

The $scopeId was already read from the event on line 26 of UpdateProductFeed.php but never passed to getStore().

Test plan

  • Save REVIEWS.io config on a standard single-store Magento setup — no regression
  • Save config on a multi-store setup where admin URL differs from any store view — no exception, correct storefront URL sent to integration/app-installed
  • Verify product feed URL uses storefront base URL, not admin hostname

Fixes REVIEWS-4382

🤖 Generated with Claude Code

Pass $scopeId to getStore() in UpdateProductFeed so store is resolved
from config scope rather than the admin HTTP hostname. Replace
$_SERVER['HTTP_HOST'] with the scope-aware base URL so the correct
storefront URL is registered with integration/app-installed.

Defer getStore() in Api constructor by storing StoreManagerInterface
instead of calling getStore() at DI injection time — avoids the
exception when no store view matches the admin backend hostname.

Fixes REVIEWS-4382.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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