🛒 WooCommerce UCP Implementation
Make your WordPress + WooCommerce store AI-ready. Enable ChatGPT, Google AI Mode, and autonomous shopping agents to transact with your products.
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
UCP is not just a static JSON file — it requires functional REST API endpoints that AI agents can interact with. For WooCommerce, this means installing a plugin that implements UCP-compatible endpoints, or building custom API integration.
The easiest way to add UCP support is with the UCP Connect for WooCommerce plugin, which handles both the UCP profile and the required API endpoints. Search "UCP Connect" in Plugins → Add New.
Implementation Methods
Choose the method that best fits your needs:
| Method | Difficulty | Best For |
|---|---|---|
| UCP Proxy (Shopify) | Medium | Full UCP checkout with AI agents (Recommended) |
| UCP Connect Plugin | Easy | Store owners, non-developers |
| Manual (functions.php) | Advanced | Developers building custom UCP API endpoints |
| Custom Plugin | Expert | Enterprise with full UCP API implementation |
If you're not a developer, the plugin method is your best option. For full AI agent checkout capabilities, consider the UCP Proxy method.
Method 1: UCP Proxy by Shopify (Recommended)
UCP Proxy is an open-source proxy by Shopify that enables full UCP checkout capabilities for WooCommerce stores. Your store remains the system-of-truth; the proxy translates UCP requests to WooCommerce API calls.
- Full checkout flow support (not just discovery)
- Google Pay integration via Stripe
- 3D Secure handling for secure payments
- Stateless architecture — scales to zero
- Official Shopify open-source project
- WooCommerce 6.9+ (for Store API support)
- WooCommerce REST API keys (Read/Write)
- Optional: Stripe plugin for Google Pay
- Go 1.21+ (for running the proxy)
# Clone the repository git clone https://github.com/Shopify/ucp-proxy cd ucp-proxy # Create config file cp config.example.json config.local.json
Edit config.local.json:
{
"port": "8080",
"adapter_type": "woocommerce",
"merchant_id": "my-store",
"merchant": {
"store_url": "https://yourstore.com",
"api_key": "ck_your_consumer_key",
"api_secret": "cs_your_consumer_secret",
"policy_links": {
"privacy_policy": "https://yourstore.com/privacy",
"terms_of_service": "https://yourstore.com/terms"
}
}
}# Start the proxy CONFIG_FILE=config.local.json go run ./cmd/proxy # Test discovery endpoint curl http://localhost:8080/.well-known/ucp
Deploy to GCP Cloud Run, AWS, or any container hosting:
# GCP Cloud Run example gcloud run deploy ucp-proxy \ --source . \ --region us-central1 \ --allow-unauthenticated
See the WooCommerce setup guide for payment configuration, 3DS handling, and production deployment.
Method 2: Using UCP Connect Plugin
The UCP Connect plugin handles everything: it creates the UCP profile, implements the required API endpoints, and enables AI agent checkout capabilities.
- Go to Plugins → Add New in your WordPress admin
- Search for "UCP Connect" or "UCP WooCommerce"
- Click Install Now, then Activate
If the plugin isn't in the repository yet, download from UCP Connect for WooCommerce and upload via Plugins → Add New → Upload Plugin.
- 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.
Validate Your WooCommerce Store
After installing the plugin, validate your UCP implementation.
Run Validation →Method 3: Manual Implementation (Developers Only)
For full control, implement UCP manually using WordPress functions. This method is for developers who need custom UCP implementations.
This method only creates a basic UCP discovery profile. For full AI agent checkout capabilities, you must also implement UCP-compatible REST API endpoints that handle product queries, cart operations, and checkout flows. The code below is a starting point, not a complete UCP implementation.
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(),
'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)
Always flush rewrite rules after adding new rewrite rules. Failing to do so will result in 404 errors.
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 |
If using WP Super Cache, W3 Total Cache, or similar, add /.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 →