Skip to main content
Cookbook WooCommerce WooCommerce

Add an affiliate product to WooCommerce with AI

List a product you recommend from another store, with your photo, description and a buy button that carries your affiliate link.

Difficulty Beginner
Time ~5 min

Prerequisites

A connected site running WooCommerce 10.9 or newer on WordPress 6.9 or newer, your affiliate link, and a public link to a photo you are allowed to use.

The prompt
Add an affiliate product to my WooCommerce store as a draft.

- Name: [product name]
- Link: [the product link with my affiliate tag, exactly as given]
- Button text: [Buy on Store Name]
- Price: [39.99] (leave empty for no price; a typed price does not update when the other store changes theirs)
- Photo: [public link to a photo I am allowed to use]
- What I know about it: [your notes]

Write a two-sentence short description from my notes, and end it with: "I earn a commission if you buy through this link." (change that sentence if you like). Create the product with the woocommerce/product-create ability: product_type_alias affiliate, name, short_description, status draft, external_url set to my link, button_text, and regular_price if I gave one. Use the price as a plain number with no currency symbol or thousands separator.

Then upload the photo with upload_media and set it as the product image with the WooCommerce REST API (PUT /wc/v3/products/ followed by the product id, with images). Do not publish.

Last, read the product back from the WooCommerce REST API (GET /wc/v3/products/ followed by the product id) and confirm the status is draft and the image is set. Show me the saved external_url, button text, price and short description so I can check my affiliate tag is still on the link, and give me the product id, the edit link and the preview link.
Already connected?

Skip pasting the full prompt. Drop this into your AI on a site that already has WPVibe:

Run the “Add an affiliate product to WooCommerce with AI” recipe from the WPVibe cookbook on my connected site.

You recommend products you do not sell yourself: the kettle you use, the book everyone asks about, the gear in your tutorials. WooCommerce can list them with a buy button that goes to the other store, but setting one up means finding the External/Affiliate type in the product screen and knowing which fields it keeps, so the recommendations stay as loose links in blog posts.

The AI creates the product through WooCommerce's own product abilities as an affiliate product, saved as a draft: your name, short description, button text and, if you give one, a price you type in, which does not change when the other store changes theirs. The button points at your link with your affiliate tag. It then uploads the photo and sets it as the product image through the WooCommerce REST API. When you publish, the product page shows the photo and your description, and the button sends the shopper to the other store. There is no cart or stock to manage.

Fill in the brackets with the product link exactly as your affiliate program gave it to you, and paste the prompt. The AI repeats the saved link back so you can check the affiliate tag survived. Say on the product, in plain words, that you earn a commission from the link, and read your program's terms: some, such as Amazon Associates, do not allow typed-in prices or copied product photos; in that case leave the price empty and use a photo you took yourself.

Outcome

A draft affiliate product with your photo, description, disclosure and a buy button that links to the other store with your tag.