ShopB2C storefront
Overview
- Scope
- ShopB2C web storefront, layout contribution, checkout channel behavior, and cache integration
Key concepts
- Storefront
- The ShopB2C web/template layer over the Shop commerce domain.
- Basket Line Resolver
- Shop contract bound by ShopB2C to B2cBasketLineResolver for storefront basket line presentation.
- Warehouse Context
- Storefront-selected warehouse/store context used by relevant catalog and stock behavior.
Structure
- Dependencies
- ModuleShopB2C
- Required ModuleShop
- Routes
- Catalog
- /catalog
- /catalog/{slug}
- /product/{slug}
- Cart
- /cart
- /cart/add
- /cart/items/{item}
- /cart/promo
- Checkout
- /checkout
- /checkout/success/{number}
- Account/dashboard/orders
- Catalog
- Contributions
- Layout Drivershop_b2c
- Page CmsShopB2CContributor tagged page.cms.contributors
- Order ValidationB2cCheckoutPlacementValidator tagged shop.order.placement.validators
Facts
- ShopB2CServiceProvider does not register its module routes when Shop is not installed. authoritative
- ShopB2C registers cart, checkout, price, promotion, warehouse, currency, cache, catalog-navigation, account-presentation, layout, and settings services. authoritative
- ShopB2C contributes a B2C checkout validator to Shop's placement-validator tag rather than replacing Shop order placement. authoritative
- When Shop is installed, the provider listens to login events and merges the guest cart through CartService. authoritative
- Storefront cache listeners react to Shop catalog-section, assortment, and settings-saved events. authoritative
- The storefront order-history route is protected by auth; catalog, cart, checkout, store-selection, newsletter, and about routes are registered separately. authoritative
- ProductCardPresenter calls PriceResolver::preloadForProductCards before rendering a product collection so storefront cards resolve prices from one batched shop_prices query per request scope. authoritative
How-to guides
Add Storefront Route
- confirm Shop dependency and current ShopB2C route registration
- place presentation/controller logic in ShopB2C
- delegate domain mutation to Shop services
- identify cache events and authenticated-account requirements
Rules
Architectural rule
Keep product, stock, and order domain rules in Shop; implement storefront presentation and channel validation in ShopB2C.
Examples
Basket Line Resolver
$this->app->bind(BasketLineResolver::class, B2cBasketLineResolver::class);
modules/ShopB2C/Providers/ShopB2CServiceProvider.php
Price Preload Batch
$this->prices->preloadForProductCards($productIds, $displayOfferIdByProductId);
modules/ShopB2C/Support/ProductCardPresenter.php
Shop Gate Routes
Use isModule by manifest name Shop, not slug shop-b2c.
if (! isModule('Shop')) { return; }
modules/ShopB2C/Providers/ShopB2CServiceProvider.php