Why Add UCP to WooCommerce?
WooCommerce powers over 5 million online stores. Adding UCP (Universal Commerce Protocol) support makes your store discoverable by AI agents, enabling automatic product discovery and purchases through ChatGPT, Google AI Mode, and other AI assistants.
- WordPress Flexibility: Full control over implementation via themes or plugins
- REST API Ready: WooCommerce's REST API makes UCP integration natural
- Schema.org Support: Many WooCommerce themes already include structured data
- Plugin Ecosystem: Dedicated UCP plugins available
Implementation Methods
Choose the method that best fits your needs:
| Method | Difficulty | Best For |
|---|---|---|
| WooUCP Plugin | Easy | Quick setup, non-developers |
| Manual (functions.php) | Medium | Full control, developers |
| Custom Plugin | Advanced | Enterprise, custom requirements |
Method 1: Using a Plugin (Recommended)
- Go to Plugins โ Add New in your WordPress admin
- Search for "WooUCP" or "UCP Commerce"
- Click Install Now, then Activate
- Go to WooCommerce โ Settings โ UCP
- Enter your store details (most will be auto-filled from WooCommerce)
- Review capabilities to expose (browse, search, checkout)
- Click Save Changes
Visit https://yourstore.com/.well-known/ucp to see your generated UCP profile.
Method 2: Manual Implementation
For full control, implement UCP manually using WordPress functions.
Generate Your UCP Profile
Create a customized UCP profile for your WooCommerce store.
Open Generator โAdd this code to your theme's functions.php or a custom plugin:
// Add rewrite rule for /.well-known/ucp function ucp_add_rewrite_rules() { add_rewrite_rule( '^\.well-known/ucp/?$', 'index.php?ucp_profile=1', 'top' ); } add_action('init', 'ucp_add_rewrite_rules'); // Register query var function ucp_query_vars($vars) { $vars[] = 'ucp_profile'; return $vars; } add_filter('query_vars', 'ucp_query_vars');
// Handle UCP profile request function ucp_template_redirect() { if (get_query_var('ucp_profile')) { header('Content-Type: application/json'); header('Access-Control-Allow-Origin: *'); $profile = [ 'profile_version' => '1.0', 'merchant' => [ 'name' => get_bloginfo('name'), 'url' => home_url(), 'description' => get_bloginfo('description'), 'contact' => [ 'email' => get_option('woocommerce_email_from_address') ] ], 'capabilities' => ['browse', 'search'], 'policies' => [ 'returns_url' => get_privacy_policy_url(), // Update as needed 'shipping_url' => home_url('/shipping-policy/'), 'privacy_url' => get_privacy_policy_url() ], 'service_bindings' => [ [ 'type' => 'REST', 'base_url' => home_url('/wp-json/wc/v3') ] ] ]; echo json_encode($profile, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); exit; } } add_action('template_redirect', 'ucp_template_redirect');
After adding the code, flush rewrite rules:
- Go to Settings โ Permalinks
- Click Save Changes (no changes needed, just save)
Schema.org Markup
For maximum AI compatibility, ensure your products have proper Schema.org markup. Many WooCommerce themes include this by default.
Recommended Plugins
- Yoast SEO: Includes WooCommerce schema support
- Rank Math: Advanced schema options for products
- Schema Pro: Dedicated schema plugin
Verify your schema with:
Validate Your Implementation
Validate Your WooCommerce Store
Check your UCP implementation and AI commerce readiness.
Run Validation โCommon Issues & Solutions
| Issue | Solution |
|---|---|
404 on /.well-known/ucp |
Flush permalinks: Settings โ Permalinks โ Save |
| CORS errors | Add Access-Control-Allow-Origin: * header |
| Wrong content type | Ensure Content-Type: application/json header |
| Caching issues | Exclude /.well-known/ucp from caching plugins |
/.well-known/ucp to the exclusion list.
๐ค Test with AI Agents
Run AI Agent Simulation
Test how AI shopping agents will interact with your WooCommerce store.
Open Simulator โ