Skip to content

About

Shopware Plugin for agentic commerce features, like Universal Commerce Protocol and native agentic discovery.

Resources

Contributing

Stars

7 stars

Watchers

0 watching

Forks

Latest commit

 

History

352 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SwagAgenticCommerce

Shopware plugin repository for Agentic Commerce features.

This repository is intentionally scoped to commerce-facing agent integrations. It is not a generic AI playground, chat assistant, or experimentation bucket. Code added here must help external agents discover, understand, or transact with a Shopware storefront in a controlled merchant-owned way.

Feature Areas

The plugin groups three related but separate Agentic Commerce surfaces:

Feature Purpose Primary audience Status
Universal Commerce Protocol (UCP) Transactional protocol surface for catalog, cart, checkout, order, identity, and payment-capability flows. Agent platforms, protocol clients, merchants configuring sales-channel exposure. Implemented in this plugin with SDK integration and lane-aware capability exposure.
Native agentic discovery Storefront discovery documents that explain how agents should interact with a shop before transactional calls happen. Crawlers, LLM shopping agents, custom agent clients, merchants defining operating rules. Implemented through the core bridge on lanes with sales-channel file support and through plugin fallback routes on older lanes.
Product feed Outbound product feed surface for agentic/catalog consumers. Feed consumers, marketplaces, AI catalog ingestion, merchants managing feed availability. Implemented with Shopware product exports for OpenAI JSONL and Google Shopping XML feeds.

These features should share sales-channel awareness, admin UX patterns, compatibility handling, and test infrastructure where possible. They should not duplicate Store API or UCP gateway logic just because they expose different agent-facing entry points.

Where Changes Belong

Keep protocol and Shopware responsibilities separated. This plugin directly requires the ucp-php-sdk/symfony-bundle Composer package, which in turn requires SDK core. The plugin should not copy SDK protocol behavior or push Shopware-specific decisions into the SDK.

Layer Owns Should not own
ucp-php-sdk Protocol models, transport controllers, profile building, capability contracts, payment handler contracts, request/response envelopes, shared exception mapping, signing/idempotency/replay/profile-cache abstractions, A2A/MCP/embedded transport shaping. Shopware repositories, Store API calls, storefront rendering details, sales-channel admin UX, Shopware version detection.
SwagAgenticCommerce plugin Shopware adapters/gateways, sales-channel scoped config, Administration UX, lane-aware feature exposure, storefront embedded rendering, native discovery contributions, product-feed integration, demo/QA scripts. New protocol semantics, duplicated transport controllers, generic SDK storage contracts, protocol error formats.
shopware/shopware core Shared platform primitives that benefit more than this plugin, for example a generic Store API MCP endpoint or native agentic discovery infrastructure. Plugin-only UCP admin behavior, PSP-specific tokenization handlers, local QA/demo shortcuts.

Default rule: if multiple merchants/frameworks could reuse it, start in the SDK. If it depends on Shopware runtime state, sales channels, Store API, Administration, or storefront rendering, finish it in the plugin. Touch core only when the primitive is generally useful outside this plugin line.

Customer-facing runtime flows must enter Shopware through Store API boundaries wherever such a boundary exists. This is a hard architecture rule for UCP adapters, gateways, and shopping flows such as catalog, cart, checkout, customer, identity, and order reads. Prefer injecting the relevant Store API route abstraction, for example Abstract*Route, so Shopware decorators, sales-channel visibility, validation, customer ownership checks, context-token handling, and route events stay in effect. Do not implement buyer-facing behavior with direct DAL repository reads/writes, manual customer creation, or hand-rolled context mutation. Repository access is acceptable for plugin-owned configuration, admin/runtime metadata, compatibility discovery, or a documented exception where no Store API route exists.

The SDK is a required runtime dependency for this plugin line. The release archive carries it as plain source under lib/ucp-php-sdk/, so SwagAgenticCommerce::executeComposerCommands() returns false there and Shopware never runs Composer for the plugin. A development checkout requires the SDK from Packagist and keeps Composer enabled. When the SDK is not usable, the plugin registers no services, routes or bundles at all; do not only suppress getAdditionalBundles() errors, because the plugin service graph contains SDK interfaces and transport contracts.

Installation

Install the release archive from the Shopware Store, or upload it under Extensions → My extensions → Upload extension. The archive brings the UCP SDK and a compiled Administration, so the shop needs neither Composer nor a build step.

A Composer project can require the extension from Packagist instead, from 1.5.0 on:

composer require shopware/agentic-commerce:^1.5
bin/console plugin:refresh
bin/console plugin:install --activate SwagAgenticCommerce
bin/build-administration.sh

Composer installs the extension into vendor/ and resolves the UCP SDK like any other dependency. The package is the Git source, so it carries no compiled Administration: build it with bin/build-administration.sh, or with shopware-cli project ci in the deployment. Without that build the extension works, but its settings in the Administration are missing. Update the extension on the command line, not through the Administration, and build the Administration again, because composer update replaces the package without a compiled Administration:

composer update shopware/agentic-commerce
bin/console plugin:update SwagAgenticCommerce
bin/build-administration.sh

Installing, updating and uninstalling the extension run no Composer in such a project, so remove the package yourself after the uninstall:

bin/console plugin:uninstall SwagAgenticCommerce
composer remove shopware/agentic-commerce

Packagist also lists 1.0.0 to 1.4.0. Do not require them: 1.0.0 accepts any Shopware version, and 1.2.0 accepts SDK releases that serve another UCP version. Require ^1.5, so Composer cannot fall back to them.

UCP

UCP provides the transaction contract for agentic shopping. The plugin exposes lane-aware UCP configuration in the Administration and wires Shopware catalog/cart/checkout/order behavior through the ucp-php-sdk.

Set up UCP on a sales channel

The whole path from "plugin activated" to "first UCP request answered", for one sales channel. You need a Storefront or Headless sales channel; every other channel type is refused. Agents find the channel only through a domain without a path, such as https://de.shop.example, because a domain like https://shop.example/de serves no UCP profile.

  1. Configure the channel in one step.

    # a laptop or a test system
    bin/console ucp:setup --sales-channel=Storefront --dev
    
    # production: strict signatures, and only the named platform may talk to the channel
    bin/console ucp:setup --sales-channel=Storefront --agent-host=agent.example.com

    ucp:setup switches UCP on for the channel, writes the security defaults, generates a signing key if the channel has none, runs the readiness checks and prints the profile URL. --dev accepts unsigned requests (policy log) and puts the channel's own domain hosts and localhost on the allowlists, so the shop can act as its own agent. Without --dev the policy is strict and nothing is allowed until you name a platform host. ucp:setup always sets --platform-policy=listed; to accept every platform, switch to All platforms in the Administration or run ucp:config:set --platform-policy=all, and clear the agent allowlist. --dry-run shows the resulting config without writing it.

  2. Locally only: turn on the SDK's development mode. Every UCP request names the calling agent's profile URL, and the SDK's URL-safety rules refuse everything a laptop can offer (*.localhost names and container hostnames resolve to loopback). In development mode the shop accepts its own /.well-known/ucp as that profile instead, so no second server is needed.

    export SWAG_AGENTIC_COMMERCE_UCP_PROFILE_FETCHING_DEVELOPMENT_MODE=1
    bin/console cache:clear

    Never set this in production: it also admits plain-http and loopback profile hosts.

  3. Make the first request. The SDK bundle prints it for you, headers and a minimal body included:

    bin/console ucp:dev:request catalog.search --base-uri=http://shop.localhost:8088

    Paste the printed curl. Expect 200 with "status": "success" in the ucp envelope. Without an argument the command lists every operation; --id fills in product and resource ids.

  4. Change and re-check. Exposure (active, profile domain, capabilities, transports, who may buy and the allowed agent platforms) lives in the Administration under the sales channel; the other allowlists and the signature policy in ucp:config:set; bin/console ucp:config:validate --sales-channel=Storefront re-runs the readiness checks any time.

What the shortcut in step 2 does and does not prove, and what to do when you need a real second profile (strict signatures, the conformance agent, a staging platform), is in the SDK's docs/local-testing.md. Which UCP version the plugin serves and what an SDK bump means for a shop is in docs/ucp-version-support.md.

Current responsibilities:

  • Configure UCP per sales channel — Storefront and Headless only. Every other type, product feed channels included, is refused: the card is hidden, the Admin API and ucp:config:set return an error, and a stale active flag reads as off.
  • Store sales-channel UCP config in the plugin-owned swag_agentic_commerce_ucp_config table. Legacy SystemConfig values are read only as a compatibility fallback and backfilled into the table when found.
  • Publish /.well-known/ucp with only capabilities and transports that are usable on the current Shopware line.
  • Expose REST, A2A (/.well-known/agent-card.json, /ucp/a2a), embedded (/ucp/embedded/*), and trunk/6.7 MCP (/ucp/mcp) flows through shared capability adapters.
  • Implement customer-facing adapter/gateway behavior through Store API routes, not direct repositories, so UCP follows the same sales-channel and customer-context rules as storefront clients.
  • Keep signing keys, OAuth identity linking, payment tokenization, platform-profile cache, and allowlists scoped to sales-channel behavior.
  • Require explicit embedded origin and frame-ancestor configuration before embedded pages render cross-origin; disallowed or missing origins return controlled UCP errors.
  • Hide unsupported capabilities instead of advertising placeholders.

Console commands

UCP is administered from the CLI for everything except the per-channel Exposure settings (active, profile domain, capabilities, transports, who may buy and the allowed agent platforms), which live in the Administration. Every command takes --sales-channel (id or name; omit it to pick interactively). Run bin/console ucp:channels first to see channel ids and which channels currently expose UCP.

Command Purpose
ucp:setup --sales-channel=… [--dev] [--agent-host=…] [--dry-run] Configure a channel for UCP in one step: exposure, security defaults, signing key, readiness check, first request. See Set up UCP on a sales channel above.
ucp:channels List the UCP-capable sales channels, their ids and UCP exposure (exposed / off).
ucp:config:show --sales-channel=… Print the resolved UCP config for a channel.
ucp:config:set --sales-channel=… … Set the non-UI config fields (below). Only the options you pass change; the rest is preserved by a merge, so admin-managed Exposure fields are never reset.
ucp:dev:request [operation] [--id=…] --base-uri=… SDK command. Print a ready-to-run curl for a UCP operation with the shop's own profile as the agent (needs the development mode from step 2 above).
ucp:signing-keys:{generate,list,show-public,retire,delete} --sales-channel=… Manage a channel's signing keys — thin subclasses of the SDK commands that map --sales-channel to the SDK tenant.

ucp:config:set fields (run it with --help for per-option examples):

  • --signature-policy=strict|log|off
  • --idempotency=true|false
  • --platform-policy=all|listed — all accepts every agent platform with a valid profile, and the platform allowlist then holds the pre-approved platforms. listed accepts only the platforms on the allowlist, and with an empty list only agents on the shop's own host. A sales channel set up for UCP from now on starts with all; one that already had UCP settings stays on listed. This is the Who may buy through UCP setting in the Administration.
  • --agent-allowlist, --remote-profile-allowlist, --platform-allowlist — bare hosts, no scheme (repeatable). The platform allowlist is also the Allowed agent platforms field in the Administration, named Pre-approved agent platforms under All platforms. The agent and remote-profile allowlists take precedence over it when set, and an agent allowlist still gates under --platform-policy=all.
  • --embedded-allowed-origins, --embedded-frame-ancestors — origins, scheme + host (repeatable)
  • --webhook-url-override — absolute https URL whose host is in an allowlist (pass an empty value to clear)
  • --continue-url-template — absolute URL supporting {checkoutId}, {cartId}, {salesChannelId} (pass an empty value to clear)

Options are omit-to-leave-unchanged; passing none is an error rather than a silent no-op. Example — allow an embedded checkout to be framed by ChatGPT and require idempotency:

bin/console ucp:config:set --sales-channel=Storefront \
    --embedded-allowed-origins=https://chatgpt.com \
    --embedded-frame-ancestors=https://chatgpt.com \
    --idempotency=true

The SDK bundle also ships storage-maintenance commands (not sales-channel scoped): ucp:storage:cleanup purges all expired SDK records (OAuth state, idempotency, negotiation sessions, profile cache, replay nonces, retired keys) using the configured retention windows, while ucp:storage:cleanup-signature-nonces purges only replay nonces with a tunable --older-than-seconds. Schedule the former periodically; reach for the latter only to prune nonces on a tighter cadence.

Compatibility and transport security

The plugin supports Shopware 6.5.8 and newer, 6.6.x, and trunk/current 6.7+ from one codebase. 6.5.0.0 through 6.5.7.4 are not supported: they ship Symfony 6.3, while both the plugin's own controllers and the UCP SDK need the routing attribute and the symfony/config version that arrived in Symfony 6.4. A shop on one of those takes the in-line update to 6.5.8.x, which stays inside the same minor. Capability exposure is feature-detected at runtime: unsupported transports are removed from the UCP profile instead of returning dead links. MCP is only advertised when the current lane has the required Store API MCP infrastructure; REST, A2A, and embedded routes stay on the shared SDK capability layer.

Every UCP sales channel has its own tenant configuration. Profile exposure must be enabled for the channel. A channel switched on in the Administration then accepts every agent platform with a valid profile; --platform-policy=listed, which ucp:setup sets, accepts only the allowlisted platform hosts. Embedded pages stay closed in both cases: they require both embeddedAllowedOrigins and embeddedFrameAncestors. Until both are configured, every embedded request returns a controlled 403 UCP response.

Once configured, the embedded surface is protected by three distinct mechanisms — do not mistake any one of them for the others:

  • Framing is restricted by embeddedFrameAncestors, emitted as Content-Security-Policy: frame-ancestors ... (and X-Frame-Options is removed so the CSP is authoritative). This is what stops a non-allowlisted page from embedding the surface, and it is enforced by the browser.
  • Cross-origin reads are restricted by embeddedAllowedOrigins, emitted as Access-Control-Allow-Origin. A request carrying an Origin header that is not on the allowlist is rejected with 403. Note that browsers omit Origin on iframe and top-level GET navigations, so an absent Origin is deliberately not treated as a denial signal — rejecting it would break every real browser load of the embedded page. embeddedAllowedOrigins is a CORS control, not a server-side authorization gate, and cannot constrain a non-browser client.
  • Authorization for the payload is possession of the cart or checkout token in the URL. That path segment is the Shopware sales-channel context token; anyone holding it can already read and write that cart through the REST and A2A transports. Treat the embedded URL as a secret. Embedded responses are sent with Cache-Control: no-store, private, Referrer-Policy: no-referrer, and X-Robots-Tag: noindex, nofollow so the token does not leak into shared caches, search indexes, or Referer headers, and they vary by Origin.

Signed-request handling, idempotency, replay nonce storage, profile cache storage, OAuth state, and retired signing keys are owned by the SDK bundle. The plugin maps those contracts to Shopware sales channels and keeps buyer-facing work inside Store API route boundaries. The acceptance suite in tests/acceptance sends signed REST and MCP requests on each lane; run it when transport behavior changes.

Native Agentic Discovery

Native agentic discovery is the storefront-facing operating manual for agents. It complements UCP: discovery tells an agent how the merchant wants the shop to be used, while UCP tells the agent which transactional capabilities are technically available.

The core reference in shopware/shopware#17033 introduces the sales-channel file primitives used by trunk/current 6.7+.

  • /agents.md
  • /llms.txt
  • /.well-known/ai-catalog.json

On lanes with SalesChannelFileDiscovery, SalesChannelFileRenderer, and the sales_channel_file table, the plugin enables the agentic file family for active UCP sales channels and lets core render the files. On older lanes, the fallback bundle provides storefront routes for the same files. Fallback discovery is only rendered when UCP is active for the current sales channel; inactive channels receive 404.

The generated documents are sales-channel scoped. They point agents at the UCP profile when UCP is active and describe safe shopping behavior for public storefront resources. Validate discovery after admin or route changes with a storefront browser check and direct GET requests for /llms.txt, /agents.md, and /.well-known/ai-catalog.json on each supported lane.

Product Feed

The product-feed feature is the outbound catalog surface for agentic commerce consumers. It is separate from UCP catalog operations: UCP handles transactional runtime calls, while product feeds support catalog ingestion, indexing, and marketplace-style discovery.

Product feeds reuse Shopware's product export infrastructure on Agentic Commerce sales channels. The Administration registers two templates:

Provider Format File format Template source
open-ai OpenAI product feed JSONL, one JSON object per valid product row agentic-product-export-templates/open-ai/body.json.twig.js
google Google Merchant Center feed XML RSS item feed agentic-product-export-templates/google/*.xml.twig.js

The templates are Twig, but they live in .js modules that export the template as a string. They must reach Shopware byte-exact — the OpenAI feed is JSONL, so newlines are significant — and every admin bundler treats a plain JS module identically, whereas an imported .twig file gets its whitespace collapsed by Shopware's Twig loader.

The feed URL is the Shopware product export URL shown in the Agentic Commerce sales-channel detail. It must be publicly reachable by the feed consumer and is not signed by UCP. Product links in both feeds include referringSalesChannel and preserve configured affiliate/campaign codes so downstream orders and customers can be attributed to the Agentic Commerce channel.

OpenAI JSONL rows include search eligibility, checkout eligibility, item and offer identifiers, title, description, URL, image URLs, price, availability, brand/seller data, return policy URL, store/target countries, GTIN/MPN, digital-product signal, and variant data when variants are included. The JSONL renderer trims blank rows, skips empty product renders, re-encodes each row as one JSON object per line, and URL-encodes spaces in media URLs.

Google XML rows include the required Merchant Center fields, canonical and tracked product links, image URLs, availability, price/sale price, condition, brand, GTIN/MPN or identifier_exists, category path, item group, variant attributes, custom labels, and shipping data derived from the sales-channel context.

Feed generation, scheduling, caching, and invalidation are owned by Shopware's product export subsystem. The plugin supplies provider-specific templates, provider context, JSONL normalization, and validation. Template defaults set generateByCronjob: false and interval: 86400; merchants can adjust export behavior through the normal Shopware product export configuration.

Troubleshooting

The extension is installed, but UCP and the product feeds do nothing

The extension says so in two places. It writes to PHP's error log — wherever the host sends it, often the container output or php_errors.log — and, when that directory is writable, to var/log/swag-agentic-commerce.log in the shop. Both carry the same line, which names the reason and the command that fixes it:

[SwagAgenticCommerce] The extension is inactive: The PHP extension ext-openssl is required by the
UCP SDK but not loaded. It registers no services, routes or feeds until that is fixed. The release
archive bundles the SDK, so Shopware installs no requirements for it. Clear the cache once the
conflict is resolved.

In a Composer project, the last sentence names the composer require command for the SDK instead.

The release archive brings its own copy of the UCP SDK; a Composer project has it in vendor/. When the extension cannot use the SDK, for example because a PHP extension the SDK needs is not loaded, the extension registers nothing instead of taking the shop down with it. The storefront keeps serving, /.well-known/ucp answers 404 rather than 500, and the product feeds stay quiet.

To recover, fix what the log entry names, then clear the cache. Deactivating and reactivating the extension in the administration has the same effect, and is the more reliable one if a worker is still serving the old state.

It is not in Shopware's own var/log/prod-*.log, and cannot be: the extension decides this while the container is being compiled, which is before any logger service exists.

Cluster setups and Composer-managed projects

The release archive needs nothing from Composer, so a cluster setup deploys it like any other extension. The archive always uses the SDK it brings, also when the shop's root vendor/ holds another copy. If you installed the archive and added ucp-php-sdk/core and ucp-php-sdk/symfony-bundle to the project's composer.json for 1.4.0, nothing uses them any more, and you can remove them with composer remove ucp-php-sdk/core ucp-php-sdk/symfony-bundle. A project that requires the extension from Packagist uses the SDK in its vendor/ instead.

A project that requires the release archive through Composer, for example through a path repository, gets the bundled SDK with it: the archive's composer.json replaces both SDK packages.

Updating from 1.4.0 or older

The first update into a release that bundles the SDK runs partly on the code of the version you update from, which does not prepare for its files being replaced. Two things to expect on that one update:

  • The request that uploads or downloads the new archive can answer 500 once. The files are extracted regardless; continue with the update and the shop recovers.
  • 1.4.0 added shopware/agentic-commerce at exactly 1.4.0 to the shop's composer.json. Once the new files are in place, that requirement cannot be met, and the next Composer run in the shop fails. The update removes it: Shopware does so itself from 6.6.10.4 on, and the extension does so on older versions. On a cluster setup nothing changes the shop's composer.json, so remove it with composer remove --no-scripts shopware/agentic-commerce. While it is there, the extension writes the steps to var/log/swag-agentic-commerce.log.

Later updates load every class of the extension before Shopware replaces its files, so they do not have these gaps.

If a console command stops with The files of SwagAgenticCommerce were replaced by version …, the files changed under the running command, for example through a deployment that copied them in. Run bin/console plugin:update SwagAgenticCommerce and then bin/console plugin:activate SwagAgenticCommerce, because Shopware deactivates an extension whose update fails.

Further reading

Document What it covers
docs/local-development.md Developing the plugin against the three Shopware lanes.
docs/qa.md Test suites, what belongs in which layer, smoke modes, build matrix.
docs/releasing.md Store and Packagist releases, the SDK pin, migrations, test packages on pull requests.
docs/manual-testing.md Manual human test steps on a lane.
docs/shopware-version-differences.md Lane-specific administration, build, and runtime differences.
docs/ucp-version-support.md Which UCP version the plugin serves, and what an SDK bump means.
CONTRIBUTING.md Rules for changes: compatibility, tests, pull requests, changelog entries.
AGENTS.md What coding agents need beyond CONTRIBUTING.md.

About

Shopware Plugin for agentic commerce features, like Universal Commerce Protocol and native agentic discovery.

Resources

Contributing

Stars

7 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages