guiziweb / sylius-shopping-assistant-plugin
AI-powered shopping assistant plugin for Sylius eCommerce.
Installs: 43
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 1
Type:sylius-plugin
pkg:composer/guiziweb/sylius-shopping-assistant-plugin
Requires
- php: ^8.2
- guiziweb/sylius-ai-platform-bundle: ^1.0
- sylius/sylius: ^2.0
- symfony/ai-agent: @dev
- symfony/ai-chat: @dev
- symfony/ai-platform: @dev
- symfony/framework-bundle: ^7.3
- symfony/rate-limiter: ^7.3
Requires (Dev)
- behat/behat: ^3.16
- cweagans/composer-patches: ^1.7
- dmore/behat-chrome-extension: ^1.4
- dmore/chrome-mink-driver: ^2.9
- doctrine/cache: ^2.2
- friends-of-behat/mink: ^1.11
- friends-of-behat/mink-browserkit-driver: ^1.6
- friends-of-behat/mink-debug-extension: ^2.1
- friends-of-behat/mink-extension: ^2.7
- friends-of-behat/page-object-extension: ^0.3
- friends-of-behat/suite-settings-extension: ^1.1
- friends-of-behat/symfony-extension: ^2.6
- friends-of-behat/variadic-extension: ^1.6
- nyholm/psr7: ^1.8
- phpstan/phpstan: ^1.12
- phpstan/phpstan-doctrine: ^1.3
- phpstan/phpstan-webmozart-assert: ^1.2
- phpunit/phpunit: ^10.5
- robertfausk/behat-panther-extension: ^1.1
- sylius-labs/coding-standard: ^4.4
- sylius-labs/suite-tags-extension: ~0.2
- sylius/sylius-rector: ^2.0
- sylius/test-application: ^2.0.0@alpha
- symfony/browser-kit: ^6.4 || ^7.1
- symfony/debug-bundle: ^6.4 || ^7.1
- symfony/dotenv: ^6.4 || ^7.1
- symfony/http-client: ^6.4 || ^7.1
- symfony/intl: ^6.4 || ^7.1
- symfony/runtime: ^6.4 || ^7.1
- symfony/web-profiler-bundle: ^6.4 || ^7.1
- symfony/webpack-encore-bundle: ^2.2
This package is auto-updated.
Last update: 2025-10-31 10:37:45 UTC
README
An AI-powered shopping assistant for Sylius e-commerce stores. This plugin adds an intelligent chat widget to help customers find products, answer questions, and navigate your store.
Overview
This plugin provides a customer-facing chat widget powered by AI (OpenAI, Anthropic, etc.) to assist shoppers in real-time. It integrates seamlessly with Sylius and uses the Guiziweb Sylius AI Platform Bundle for AI configuration.
Features
- Smart Chat Widget: Interactive chat interface on shop pages
- AI-Powered Responses: Natural language understanding using GPT-4, Claude, or other AI models
- Advanced AI Tools: 7 specialized tools for e-commerce interactions:
- Product Search: Search catalog by name, description, or category with price filtering
- Product Details: Get complete product information including variants, prices, and stock
- Cart Management: Add/remove items, view cart contents with pricing
- Visual Product Cards: Display product images and information inline
- Smart Navigation: Redirect users to cart, checkout, account, or product pages
 
- Multi-Channel Support: Different AI agents per Sylius channel
- Conversation History: Stores chat history for customer context
- Admin Configuration: Configure widget behavior, AI agent, and welcome message
- Markdown Support: Rich formatted responses with markdown rendering
- Metadata System: Return structured data (products, redirect URLs) alongside AI responses
Requirements
- PHP 8.2 or higher
- Sylius 2.0 or higher
- Guiziweb Sylius AI Platform Bundle (installed automatically as a dependency)
- An API key from OpenAI, Anthropic, or another supported AI provider
Installation
Quick Installation (Recommended)
The plugin uses Symfony Flex for automatic configuration:
composer require guiziweb/sylius-shopping-assistant-plugin
This will automatically:
- Register the bundle in config/bundles.php
- Create configuration files in config/packages/
- Add JavaScript imports to assets/shop/entrypoint.js
- Install the markednpm package for markdown rendering
- Build frontend assets
Configuration Requirements
To enable Symfony Flex recipes from this repository, add the custom recipe endpoint to your composer.json:
{
    "extra": {
        "symfony": {
            "allow-contrib": true,
            "endpoint": [
                "https://api.github.com/repos/Guiziweb/SyliusRecipes/contents/index.json?ref=flex/main",
                "https://api.github.com/repos/Sylius/SyliusRecipes/contents/index.json?ref=flex/main",
                "flex://defaults"
            ]
        }
    }
}
Note: You also need to set "minimum-stability": "dev" and "prefer-stable": true in your composer.json until a stable release is tagged.
Post-Installation
- 
Run database migrations: php bin/console doctrine:migrations:migrate -n 
- 
Configure AI Platform (if not already done): Navigate to Admin Panel → AI Configuration → Platform Configurations and create a new platform configuration with your AI provider credentials. 
- 
Configure AI Agent: Navigate to Admin Panel → AI Configuration → Agent Configurations and create an agent for your shopping assistant. 
- 
Clear cache: php bin/console cache:clear 
Database UTF-8 Support
⚠️ IMPORTANT: AI responses may contain emojis. Configure UTF-8 support:
For MySQL, add to your .env:
DATABASE_URL=mysql://user:password@host/database?charset=utf8mb4
And in config/packages/doctrine.yaml:
doctrine: dbal: charset: utf8mb4 default_table_options: charset: utf8mb4 collate: utf8mb4_unicode_ci
PostgreSQL uses UTF-8 by default, no configuration needed.
Configuration
Chat Widget Configuration
Navigate to Admin Panel → Configuration → Chat Widget to configure:
- Channel: Select which Sylius channel this configuration applies to
- AI Agent: Select which AI agent to use for this channel
- Welcome Message: Customizable welcome message shown to customers
- Enable/Disable: Activate or deactivate the widget
AI Agent Setup
- 
Create Platform Configuration (Admin → AI Configuration → Platform Configurations): - Code: openai_shop
- Provider: OpenAI
- API Key: Your OpenAI API key
 
- Code: 
- 
Create Agent Configuration (Admin → AI Configuration → Agent Configurations): - Code: shopping_assistant
- Channel: Select your shop channel
- Platform: openai_shop
- Model: gpt-4
- System Prompt: Define how the assistant should behave
 
- Code: 
Example System Prompt:
You are a helpful shopping assistant for our online store. Help customers:
- Find products that match their needs
- Answer questions about products, shipping, and returns
- Provide recommendations based on their preferences
Be friendly, concise, and always prioritize customer satisfaction.
Usage
Once configured, the chat widget will automatically appear on your shop pages. Customers can:
- Click the chat icon to start a conversation
- Ask questions about products
- Get recommendations
- Inquire about orders and policies
The AI assistant will use the configured agent to provide intelligent, context-aware responses.
AI Tools
The plugin provides 7 specialized tools that the AI assistant can use to interact with your store:
| Tool | Description | Parameters | Example Usage | 
|---|---|---|---|
| search_products | Search for products in the catalog by name, description, or category | query(string): Search querypriceMax(int, optional): Max price filterlimit(int, optional): Max results (default: 5) | "Find me blue jeans under 100 EUR" | 
| get_product_info | Get detailed product information including variants, prices, stock, and attributes | slug(string): Product slug | "Tell me more about the Azure Dream Jeans" | 
| show_product_card | Display visual product cards with images, names, and prices inline in the chat | slugs(array): Array of product slugs to display | "Show me these products visually" | 
| view_cart | View the current shopping cart contents with full details | None | "What's in my cart?" | 
| add_to_cart | Add a product variant to the shopping cart | productCode(string): Exact product code from search resultsproductVariantCode(string, optional): Specific variant codequantity(int, optional): Quantity to add (default: 1) | "Add the Azure Dream Jeans in size M to my cart" | 
| remove_from_cart | Remove a specific product variant from the cart | productVariantCode(string): Exact variant code from view_cart | "Remove the blue jeans from my cart" | 
| redirect | Redirect the user to specific pages in the store | route(string): Route name ('cart', 'checkout', 'account', 'products', 'product')productSlug(string, optional): Required when route is 'product' | "Take me to checkout" | 
Tool Usage in System Prompts
When configuring your AI agent, you can guide the assistant on how to use these tools effectively:
You are a helpful shopping assistant with access to the following tools:
1. search_products - Use this to find products matching customer needs
2. get_product_info - Use this to get detailed information about specific products
3. show_product_card - Use this to visually display products to customers
4. add_to_cart - Use this when customers want to purchase items
5. view_cart - Use this to show customers what's in their cart
6. remove_from_cart - Use this when customers want to remove items
7. redirect - Use this to navigate customers to cart, checkout, or product pages
Always use search_products first when customers ask about products. When adding to cart, always
use the exact product codes returned by search_products.
Maintenance
Cleaning Old Conversations
Chat conversations are stored in the database and can accumulate over time. Clean them periodically:
# Delete conversations older than 30 days (default) php bin/console guiziweb:chat:clean-conversations # Delete conversations older than 7 days php bin/console guiziweb:chat:clean-conversations --days=7 # Delete ALL conversations (with confirmation) php bin/console guiziweb:chat:clean-conversations --all
Automated Cleanup
Add to your crontab:
# Run daily at 3 AM 0 3 * * * cd /path/to/project && php bin/console guiziweb:chat:clean-conversations
Development
This repository contains a plugin skeleton for testing and development.
Running Tests
# PHPUnit vendor/bin/phpunit # Behat vendor/bin/behat # Code Quality vendor/bin/phpstan analyse vendor/bin/ecs check
Test Application Setup
# Install dependencies composer install # Setup test application assets (cd vendor/sylius/test-application && yarn install && yarn build) vendor/bin/console assets:install # Setup database vendor/bin/console doctrine:database:create vendor/bin/console doctrine:migrations:migrate -n vendor/bin/console sylius:fixtures:load -n # Run local server symfony server:start -d
License
This plugin is released under the MIT License. See the bundled LICENSE file for details.
Credits
Developed by Guiziweb for the Sylius e-commerce platform.
Support
For issues and feature requests, please use the GitHub issue tracker.