How to Format Attribute Output Using Commands

CTX Feed pulls values from your WooCommerce products, such as title, description, and price, and puts them into a feed file that is sent to channels like Google Shopping, Meta, or Bing. Output formatting commands let you change how those values look in the feed, without editing your actual products.

A few examples of what you can do: make a title all uppercase, cut a description down to 80 characters, remove HTML tags from a description, or replace one word with another. The changes only appear in the feed — your WooCommerce products stay the same.

Where Do You Type a Command?

Every field in your feed has a small text box on the right side called the Output box. It sits right next to the attribute value dropdown. You type your formatting command there — one field at a time.

How to find the Output box?

  1. Go to CTX Feed → Manage Feeds and open the feed you want to edit.
  2. In the field list, find the row for the field you want to format — for example, Title or Description.
  3. Look to the right of the attribute dropdown on that row. You will see a small text input — that is the Output box. Type your command there.
  4. Click Save, then go to Manage Feeds and click Update Feed to rebuild the feed with your command applied.

Three Rules Every Command Must Follow

All formatting commands use the same structure. Follow these three rules, and every command will work correctly.

Command syntax rules:

[strtoupper]
✓ Rule 1 — Wrap every command in square brackets. strtoupper — no brackets means the command will not run.

[substr 0 80]
✓ Rule 2 — Leave a space before each value inside the brackets. [substr080] — missing spaces will cause errors.

[strtoupper], […] -

Rule 3 — Add […] at the end as a fallback. If the command returns nothing, CTX Feed uses the original product value instead. Always include […] unless you are sure the field will never be empty.

Clean Up the Value

Remove HTML tags, shortcodes, or broken characters that channels cannot read.

1. [strip_tags]— Remove all HTML tags, leave plain text

Removes all HTML tags and leaves plain text only. Product descriptions often have bold text, paragraph tags, links, and other HTML that channels like Google Shopping do not accept. This command strips all of that out in one step.

BeforeAfter
<p>Great <strong>shoes</strong> for trail running.</p>Great shoes for trail running.

Type in the Output box: [strip_tags], […]

2. [strip_shortcodes]— Remove WordPress shortcodes

Removes WordPress shortcodes from the value. Shortcodes are special tags that page builders and plugins add to descriptions — things like [button link="..."] or [vc_row]. They appear as broken text inside a feed. This command deletes them and leaves the rest of the description untouched.

BeforeAfter
Durable trail shoes. [button link=”buy-now”]Durable trail shoes.

Type in the Output box: [strip_shortcodes], […]

3. [htmlentities]— Convert special characters to safe HTML codes

Converts characters like &<, and > into their safe HTML equivalents — &amp;&lt;&gt;. Use this when special characters in a title or description are causing your XML feed to fail validation or break entirely.

BeforeAfter
Shoes & Boots <2024 Range>Shoes &amp; Boots &lt;2024 Range&gt;

Type in the Output box: [htmlentities], […]

4. [clear]— Remove broken or invisible characters

Removes any characters that are not valid UTF-8 text. This is useful when product data was copied from old systems or spreadsheets and contains invisible characters that cause feed validation errors.

Type in the Output box: [clear], […]

Cut and Replace Text

Trim values to a set length or swap out specific words and phrases.

1. [substr start length]— Cut to a set number of characters

Cuts the value down to a set number of characters. The first number is where to start — always use 0 to start from the beginning. The second number is how many characters to keep.

Before — 108 charactersAfter — [substr 0 80]
Blue Running Shoes For Men With Extra Cushioning And Wide Toe Box — Perfect For Long Distance Trail RunsBlue Running Shoes For Men With Extra Cushioning And Wide Toe Box — Perfect Fo

💡Google Shopping allows titles up to 150 characters. Use [substr 0 150] on your Title field to make sure nothing goes over the limit.

Type in the Output box: [substr 0 80], […]

2. [str_replace => find => replace]— Swap one word or phrase for another

Finds an exact word or phrase and replaces it with something else. Write the word to find after the first =>, and the replacement word after the second =>.

BeforeAfter [str_replace => ABC => XYZ]
ABC Running ShoesXYZ Running Shoes

⚠️ Replacing a comma? Use the word comma as your replacement value instead of a real comma character. A real comma in the Output box will break the command. Example: [ str_replace => old text => comma ]

Type in the Output box: [ str_replace => ABC => XYZ], […]

3. [preg_replace /pattern/ replacement]— Replace text using a pattern (advanced)

A more powerful version of str_replace. Instead of matching one exact word, it matches a pattern — for example, any text that looks a certain way. The pattern goes between two forward slashes /like this/. Use this when str_replace is not flexible enough for your needs.

BeforeAfter [preg_replace /abc/ qwe]
Buy abc shoes nowBuy qwe shoes now

Type in the Output box: [preg_replace /abc/ qwe], […]

Format Numbers and Prices

Control decimal places and thousands separators for price and number fields.

[number_format decimals decimal-sep thousands-sep] — Format a price or number

Sets the number of decimal places and which characters to use as the decimal point and the thousands separator. All three options are optional — you can use just [number_format] for basic formatting, or add values for full control. Separator options are: pointcomma, or space.

CommandWhat it produces (input: 1234.5)
[number_format]1,234 — basic, no decimals shown
[number_format 2]1,234.50 — two decimal places
[number_format 2 point]1,234.50 — point as decimal separator
[number_format 2 comma]1,234,50 — comma as decimal separator
[number_format 2 point space]1 234.50 — space between thousands
[number_format 2 comma point]1.234,50 — European format
[number_format 2 point comma]1,234.50 — US format
[number_format 2 point point]1.234.50

Fix Links

Switch all URLs in a field between HTTP and HTTPS.

1. [urlToSecure]— Change http:// to https://

Converts every http:// link in the field to https://. Use this on image URL or product link fields when your store has moved to HTTPS but some older product records still contain plain HTTP addresses.

BeforeAfter
http://mystore.com/shoe.jpghttps://mystore.com/shoe.jpg

Type in the Output box: [urlToSecure], […]

Variable Product Commands

These commands control what value shows up when a product has variations — like different sizes or colours. By default, CTX Feed shows the variation’s own value. These commands let you pull from the parent product instead, which is useful for fields like description that most variations do not have.

[parent_if_empty]— Use the parent value only when the variation has nothing

If the variation has its own value for this field, that value is used. If the variation’s field is empty, CTX Feed falls back to the parent product’s value. This is the most commonly used variable product command — ideal for descriptions since most variations do not have their own.

Before Variation description (empty)After [ parent_if_empty]
[blank — nothing shown in the feed]Durable trail running shoe with wide toe box… (from parent product)

Type in the Output box: [ parent_if_empty], […]

2. [parent]— Use the parent value first, fall back to the variation

The reverse of [parent_if_empty]. Tries the parent product’s value first. If the parent field is empty, it uses the variation’s value as a fallback.

Type in the Output box: [parent], […]

3. [only_parent]— Always use the parent product’s value, no exceptions

Forces CTX Feed to always show the parent product’s value for this field — even when the variation has its own value. The variation’s own value is ignored.

Type in the Output box: [only_parent], […]

No Longer Working

[convert FROM TO]— Currency conversion (disabled)

This command has been turned off and will not work. Do not use [convert USD AUD] or any other currency conversion command — it will not change prices in the feed. For currency conversion, use a dedicated WooCommerce currency plugin instead.

Combining Multiple Commands

You can chain more than one command together in the same Output box. Separate them with commas. CTX Feed runs them from left to right — the result of the first command is passed into the second, and so on.

Example combinations

[strip_tags], [strtoupper], […]

Removes HTML tags first, then makes the clean text all uppercase.
Result: plain uppercase text with no HTML.

[strip_tags], [substr 0 150], […]

Removes HTML tags first, then trims the result to 150 characters.
Result: clean plain text within the Google Shopping title character limit.

[strip_shortcodes], [strip_tags], [ucfirst], […]

Removes shortcodes, removes HTML, then capitalises the first letter.
Result: a clean, sentence-style description with no markup.

4 thoughts
  1. Hi!
    I want to replace all empty descriptions with a “there’s no description here!” description.
    Is there a command for “empty” or something similar?
    I was thinking about the str_replace command, but I can’t find the word for empty.
    Thanks!

Leave a Reply