๐Ÿ›’ WooCommerce UCP Implementation

Make your WordPress + WooCommerce store AI-ready. Enable ChatGPT, Google AI Mode, and autonomous shopping agents to transact with your products.

๐Ÿค– AI Agent Ready ๐Ÿ“ฆ Plugin Available ๐Ÿ”ง Developer Friendly ๐Ÿ”’ Secure

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
๐Ÿ”Œ WooUCP Plugin The easiest way to add UCP support is with the WooUCP plugin, which automatically generates your UCP profile from your WooCommerce settings.

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)

1Install WooUCP Plugin
  1. Go to Plugins โ†’ Add New in your WordPress admin
  2. Search for "WooUCP" or "UCP Commerce"
  3. Click Install Now, then Activate
๐Ÿ’ก Alternative If the plugin isn't in the repository yet, you can download it from GitHub and upload via Plugins โ†’ Add New โ†’ Upload Plugin.
2Configure the Plugin
  1. Go to WooCommerce โ†’ Settings โ†’ UCP
  2. Enter your store details (most will be auto-filled from WooCommerce)
  3. Review capabilities to expose (browse, search, checkout)
  4. Click Save Changes
3Verify Installation

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.

1Generate Your UCP Profile

Generate Your UCP Profile

Create a customized UCP profile for your WooCommerce store.

Open Generator โ†’
2Add Rewrite Rule

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');
3Create the Response Handler
// 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');
4Flush Rewrite Rules

After adding the code, flush rewrite rules:

  1. Go to Settings โ†’ Permalinks
  2. Click Save Changes (no changes needed, just save)
โš ๏ธ Important 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
๐Ÿ’ก Caching Tip 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 โ†’

Resources