Categories: OpenAI Ads
Tags:

Artificial Intelligence is changing how people discover, compare and purchase products online. Traditionally, customers searched for products through Google, visited ecommerce websites, compared prices and finally decided where to buy. However, AI-powered platforms are introducing a different shopping experience where users can describe what they need and receive relevant product recommendations through conversational interfaces.

ChatGPT is becoming an important part of this changing digital commerce environment. Businesses can use structured product feeds to share their product information with OpenAI, making their catalog available for supported product advertising and shopping experiences.

For WooCommerce store owners, this creates an interesting opportunity. Instead of manually preparing product spreadsheets every time prices or stock levels change, businesses can generate a dynamic product feed directly from their WordPress website.

In this guide, we will explore how to create a ChatGPT product feed for WooCommerce using PHP, generate CSV data automatically, and connect the feed through the Hosted URL option available in the OpenAI product feed interface.

1. What Is a ChatGPT Product Feed?

A product feed is a structured file containing information about the products available in an ecommerce store. It generally includes product names, descriptions, prices, images, availability, product URLs and seller information.

See an example feed:

Search engines, advertising platforms and ecommerce marketplaces use product feeds to understand what a business sells and display relevant products to potential customers.

OpenAI also supports product feeds for its advertising and commerce-related experiences. These feeds allow businesses to provide structured information about their product catalogs.

For example, imagine an ecommerce website selling electronics, clothing, educational products or home accessories. Its product feed can communicate important information such as:

  • Product name and unique identification number.
  • Product description and brand.
  • Product landing page URL.
  • Product image URL.
  • Regular price and discounted price.
  • Current stock availability.
  • Seller name and website.
  • Supported countries and currency.
  • Advertising eligibility.

This structured information helps platforms understand individual products instead of relying entirely on extracting information from website pages.

2. Why WooCommerce Stores Need a Dynamic Product Feed

WooCommerce is one of the most widely used ecommerce platforms within the WordPress ecosystem. It provides product management, inventory management, pricing, variations, categories and order management through an accessible administration dashboard.

However, maintaining product information across multiple external platforms can become challenging.

Consider an online store with 500 products. Every week, some products might receive updated prices, certain items might go out of stock, and new products might be introduced.

If the business maintains a manually prepared CSV file, someone must continuously update the spreadsheet and upload it again.

This creates unnecessary administrative work and increases the possibility of outdated information.

A dynamic PHP-based product feed offers a more convenient approach.

Instead of maintaining a separate spreadsheet, PHP can retrieve information directly from the WooCommerce database using its available product functions.

Whenever the feed is requested, it can generate the latest available product information.

Some important advantages include:

Automatic price updates: The feed can retrieve current product prices directly from WooCommerce.

Stock synchronization: Product availability can reflect the latest inventory status.

New product inclusion: Newly published products can automatically appear in subsequent feed generations.

Reduced manual work: Store administrators do not need to prepare a new spreadsheet for every catalog update.

Better catalog management: Product information remains connected to the original WooCommerce database.

3. Understanding OpenAI Product Feed Integration

OpenAI provides a product feed management interface where eligible businesses can create and manage product catalogs.

During feed creation, users provide a display name and select their preferred product submission method.

The available options include:

Upload CSV or TXT: Suitable for businesses that want to upload product files manually. This is convenient for occasional catalog updates or initial testing.

Hosted URL: Suitable for businesses that already have a product feed available at a stable HTTPS address. OpenAI can retrieve the product file from the configured URL.

SFTP Connection: Suitable for technical teams that want to automate server-to-server product file transfers.

For a WooCommerce website running WordPress, Hosted URL is an interesting option because PHP can generate the product feed whenever the external platform requests it.

There is no need to create a new CSV manually after every product update.

The important requirement is that the URL must return the actual product feed file in a supported format, rather than a normal HTML webpage.

4. Generating a Product Feed Using PHP

WooCommerce stores product information in its WordPress database. Developers can access this information through WooCommerce’s built-in functions.

Instead of directly writing complicated database queries, developers can use functions such as wc_get_products() to retrieve published products.

A custom PHP implementation can then process the returned product objects and generate a CSV file.

The general workflow involves:

  1. Retrieving published WooCommerce products.
  2. Reading product names and descriptions.
  3. Extracting product SKUs or unique IDs.
  4. Retrieving regular and sale prices.
  5. Checking product stock availability.
  6. Retrieving product image URLs.
  7. Identifying product brands.
  8. Generating correctly formatted CSV rows.
  9. Returning the CSV through a publicly accessible HTTPS URL.

For variable products, the implementation should also consider individual variations.

For example, a clothing product might have different sizes and colours. Each purchasable variation can have its own SKU, price, stock status and selected attributes.

Exporting variations individually helps communicate more precise product information.

The implementation should also handle missing product descriptions, unavailable images, products without SKUs and products that are not purchasable.

A well-designed feed should use stable product identifiers so that the same product is recognised consistently across subsequent updates.

Here is he full code for feed:


<?php
/**
 * Template Name: ChatGPT USA Product Feed
 * Description: WooCommerce CSV feed for OpenAI product discovery and Ads.
 */

if (!defined('ABSPATH')) {
    exit;
}

if (!class_exists('WooCommerce')) {
    wp_die('WooCommerce is required.');
}

/* ==========================================
   FEED CONFIGURATION
========================================== */

$feed_currency  = 'INR';
$target_country = 'US';
$store_country  = 'US';

$seller_name = get_bloginfo('name');
$seller_url  = home_url('/');

// Replace with your actual brand if no product brand is configured.
$brand_fallback = get_bloginfo('name');

// Your public return policy page.
$return_policy = home_url('/refund_returns/');

/* ==========================================
   CSV HEADERS
========================================== */

while (ob_get_level()) {
    ob_end_clean();
}

nocache_headers();

header('Content-Type: text/csv; charset=UTF-8');
header('Content-Disposition: inline; filename="chatgpt-usa-product-feed.csv"');
header('X-Content-Type-Options: nosniff');

$output = fopen('php://output', 'w');

// UTF-8 BOM for Excel compatibility.
fwrite($output, "\xEF\xBB\xBF");

$headers = [
    'item_id',
    'title',
    'description',
    'url',
    'brand',
    'image_url',
    'price',
    'availability',
    'seller_name',
    'seller_url',
    'sale_price',
    'return_policy',
    'target_countries',
    'store_country',
    'is_eligible_search',
    'is_eligible_checkout',
    'is_ads_eligible'
];

fputcsv($output, $headers);

/* ==========================================
   BRAND DETECTION
========================================== */

function openai_get_product_brand($product, $fallback) {

    $brand = $product->get_attribute('pa_brand');

    if (!$brand) {
        $brand = $product->get_attribute('brand');
    }

    if (!$brand && taxonomy_exists('product_brand')) {

        $terms = get_the_terms(
            $product->get_id(),
            'product_brand'
        );

        if ($terms && !is_wp_error($terms)) {
            $brand = implode(', ', wp_list_pluck($terms, 'name'));
        }
    }

    return $brand ?: $fallback;
}

/* ==========================================
   STOCK STATUS
========================================== */

function openai_get_availability($product) {

    if (!$product->is_in_stock()) {
        return 'out_of_stock';
    }

    if ($product->is_on_backorder(1)) {
        return 'backorder';
    }

    return 'in_stock';
}

/* ==========================================
   EXPORT PRODUCT
========================================== */

function openai_export_product($product, $parent = null) {

    global $output;
    global $feed_currency;
    global $target_country;
    global $store_country;
    global $seller_name;
    global $seller_url;
    global $brand_fallback;
    global $return_policy;

    if (!$product || !$product->exists()) {
        return;
    }

    if (!$product->is_purchasable()) {
        return;
    }

    $parent = $parent ?: $product;

    // Product image.
    $image_id = $product->get_image_id();

    if (!$image_id) {
        $image_id = $parent->get_image_id();
    }

    $image_url = $image_id
        ? wp_get_attachment_image_url($image_id, 'full')
        : '';

    // Image is required.
    if (!$image_url) {
        return;
    }

    // Product name.
    $title = $parent->get_name();

    // Product URL.
    $url = $parent->get_permalink();

    // Variation details.
    if ($product->is_type('variation')) {

        $attributes = $product->get_variation_attributes();
        $labels = [];

        foreach ($attributes as $key => $value) {

            $attribute = str_replace('attribute_', '', $key);

            $label = wc_attribute_label($attribute, $parent);

            $labels[] = $label . ': ' . $value;
        }

        if ($labels) {
            $title .= ' - ' . implode(', ', $labels);
        }

        $url = add_query_arg(
            $attributes,
            $parent->get_permalink()
        );
    }

    // Description.
    $description = $product->get_description();

    if (!$description) {
        $description = $parent->get_short_description();
    }

    if (!$description) {
        $description = $parent->get_description();
    }

    $description = wp_strip_all_tags(
        strip_shortcodes($description)
    );

    $description = trim(
        preg_replace('/\s+/', ' ', $description)
    );

    // Required description fallback.
    if (!$description) {
        $description = $title;
    }

    // Brand.
    $brand = openai_get_product_brand(
        $product,
        $brand_fallback
    );

    // Regular price.
    $regular_price = $product->get_regular_price();

    if ($regular_price === '') {
        $regular_price = $product->get_price();
    }

    $regular_price = (float) $regular_price;

    if ($regular_price <= 0) {
        return;
    }

    $price = number_format(
        $regular_price,
        wc_get_price_decimals(),
        '.',
        ''
    ) . ' ' . $feed_currency;

    // Sale price.
    $sale_price = '';

    if ($product->is_on_sale()) {

        $sale = (float) $product->get_sale_price();

        if ($sale > 0 && $sale < $regular_price) {

            $sale_price = number_format(
                $sale,
                wc_get_price_decimals(),
                '.',
                ''
            ) . ' ' . $feed_currency;
        }
    }

    // Stable item ID.
    $item_id = $product->get_sku();

    if (!$item_id) {
        $item_id = (string) $product->get_id();
    }

    // Stock.
    $availability = openai_get_availability($product);

    // Product feed row.
    $row = [
        (string) $item_id,
        wp_strip_all_tags($title),
        $description,
        esc_url_raw($url),
        $brand,
        esc_url_raw($image_url),
        $price,
        $availability,
        $seller_name,
        esc_url_raw($seller_url),
        $sale_price,
        esc_url_raw($return_policy),
        $target_country,
        $store_country,
        'true',   // Product discovery
        'false',  // Direct checkout disabled
        'true'    // Ads eligible
    ];

    fputcsv($output, $row);
}

/* ==========================================
   GET WOOCOMMERCE PRODUCTS
========================================== */

$products = wc_get_products([
    'status'  => 'publish',
    'limit'   => -1,
    'orderby' => 'ID',
    'order'   => 'ASC',
    'return'  => 'objects'
]);

foreach ($products as $product) {

    // Variable products: export each variation.
    if ($product->is_type('variable')) {

        $variation_ids = $product->get_children();

        foreach ($variation_ids as $variation_id) {

            $variation = wc_get_product($variation_id);

            if (
                $variation &&
                $variation->get_status() === 'publish'
            ) {
                openai_export_product(
                    $variation,
                    $product
                );
            }
        }

    } else {

        // Simple products.
        openai_export_product($product);
    }
}

/* ==========================================
   FINISH
========================================== */

fclose($output);
exit;

5. Important Product Fields Required by OpenAI

Generating a CSV is only one part of the integration. The data must also follow the product feed specification published by OpenAI.

Some of the important fields include:

FieldPurpose
item_idUnique product identification
titleProduct name
descriptionProduct information
urlProduct landing page
brandManufacturer or product brand
seller_nameBusiness selling the product
image_urlMain product image
availabilityCurrent stock status
priceProduct price and currency
target_countriesSupported destination markets
store_countrySeller’s store country
is_ads_eligibleAdvertising eligibility

Other optional fields can provide additional information about products, shipping, returns, images and product variations.

One important consideration is currency.

The product feed should communicate the actual product price using the appropriate ISO currency code. For example, an Indian Rupee price should use INR, while a US Dollar price should use USD.

If a business targets customers in the United States but maintains its WooCommerce prices in INR, it should confirm that the configured OpenAI feed and advertising account accept that currency combination.

A country selection alone does not automatically convert product prices or establish international shipping availability.

6. Connecting WooCommerce Through the Hosted URL Method

Once the PHP implementation is ready, the next step is connecting the generated feed to OpenAI.

First, create a dedicated WordPress page template that generates the CSV response.

For example, a website might expose its feed through an address such as:

https://slidescope.in/product_feed?preview=1

This URL should return the actual CSV content whenever it is accessed.

Next, open the product feed management section in OpenAI Ads Manager.

Create a new feed and provide a suitable display name, such as My WooCommerce Product Catalog.

Choose Hosted URL as the submission method.

The next configuration screen allows the business to provide its hosted product feed address.

Enter the publicly accessible HTTPS URL generated by the WordPress implementation.

OpenAI can then retrieve and process the product information from the configured location.

One important distinction is that a product feed URL and a browser-friendly product preview serve different purposes.

A preview page can display products in an HTML table for administrators, while the actual feed URL should return valid CSV data.

Both can be implemented separately without affecting the underlying WooCommerce store.

7. Product Feed Validation and Common Errors

Before connecting a feed to an advertising account, it is important to test its output.

A CSV file may open successfully in a browser or spreadsheet application and still contain invalid product information.

Some common issues include:

Missing product identifiers: Every product should have a stable and unique item ID.

Incorrect currency formatting: Prices should follow the required monetary format, including the appropriate currency code.

Unavailable images: Product image URLs should be publicly accessible and point directly to valid image files.

Incorrect stock information: Out-of-stock products should not be reported as available.

Missing descriptions: Products should contain meaningful factual descriptions rather than empty or placeholder content.

Invalid product URLs: Every product should link to its relevant product detail page.

Incorrect country information: Country fields must follow the configuration and supported market requirements of the feed.

CSV formatting also matters. Commas, quotation marks and line breaks inside product descriptions must be escaped correctly.

After uploading or connecting the feed, check the processing history in the OpenAI interface. Review accepted and rejected product counts and correct any reported errors.

A successful file retrieval does not necessarily mean that every product has been accepted.

8. Keeping Product Information Updated Automatically

One of the biggest advantages of using a dynamic product feed is the ability to retrieve updated catalog information without manually preparing spreadsheets.

Suppose an ecommerce business changes the price of a product from INR 1,499 to INR 1,299.

The next time the PHP feed is generated, it can retrieve the updated WooCommerce price.

Similarly, when a product becomes unavailable, the feed can communicate its new stock status.

Newly published products can also appear automatically.

However, generating updated information does not mean that OpenAI processes it instantly.

The platform must retrieve and process the latest feed before changes are reflected in its product catalog or advertising eligibility.

Businesses should also configure an appropriate feed refresh schedule and monitor ingestion history.

For larger stores, caching, pagination and scheduled feed generation can help reduce server load and improve reliability.

9. Security and Performance Considerations

Although a product feed is generally intended to be publicly accessible, it should be implemented carefully.

The feed should expose only information intended for public product discovery or advertising.

Customer information, private order details, administrator credentials and internal WooCommerce data must never be included.

Developers should also consider the following:

  • Use HTTPS for the feed URL.
  • Validate product URLs and image URLs.
  • Avoid exposing database credentials.
  • Use WooCommerce functions instead of unrestricted database access.
  • Prevent unwanted WordPress theme output before CSV headers.
  • Implement caching for large product catalogs.
  • Monitor server memory usage and execution time.
  • Test the feed after WooCommerce updates.

A store containing thousands of products may require a more advanced implementation using scheduled exports and cached CSV files instead of generating the entire catalog on every request.

10. Is a ChatGPT Product Feed Worth Implementing?

For businesses operating WooCommerce stores, product feed integration is an interesting development in ecommerce marketing.

As conversational Artificial Intelligence becomes more important in product research and online shopping, businesses need reliable ways to communicate their product catalogs to emerging platforms.

A structured feed provides a standardised way to share product details, prices, images and availability.

It can also reduce the manual effort involved in maintaining product information across advertising systems.

However, connecting a product feed does not guarantee that every product will appear in ChatGPT recommendations or receive advertising impressions.

Product eligibility, account availability, advertising configuration, platform processing and other requirements still apply.

Businesses should therefore treat product feed integration as one component of their broader ecommerce and digital marketing strategy.

Conclusion

Creating a ChatGPT product feed for WooCommerce does not necessarily require a complicated third-party integration or an expensive subscription-based plugin.

A custom PHP implementation can retrieve product information directly from WooCommerce and generate a structured CSV file containing the information required by OpenAI.

By using the Hosted URL method, businesses can make their product catalog available through a stable HTTPS address and reduce the need for repeated manual file uploads.

The most important part is maintaining accurate product information, following the official feed specification, validating the generated CSV and monitoring product ingestion.

As Artificial Intelligence continues to influence online product discovery and advertising, WooCommerce businesses should start exploring ways to make their product catalogs accessible to these emerging platforms.

A dynamic product feed is a practical starting point for preparing an ecommerce business for this changing digital commerce environment.

Official references

The following documentation supports the technical details in the article: