How to replace any string from feed?

You can replace any string in your feed using Woo Feed Plugin. This advantage is only accessible in our Premium Plugin. Using the advanced Command it’s possible to replace any string from the feed.

You may want to replace any word with your own word when it exists in an attribute value. Suppose, in some products your product’s titles contain a word called Small, but you want your feed to be generated with S instead of Small also you don’t want to change your original product title on the Site. So, how will you do it? We are going to cover the solution here. 

There are two options to replace any string from feed.

Option 1:

It is pretty simple. Let’s start…

  1. At first, In the feed edit page, click on the “Filter” tab.

    CTX feed filter tab

In the Filter tab, you will find an option String Replace. Select an attribute, give a search value and replace the value. You can also add multiple strings replace by click on the “Add New Row” button. Then click on the Update and Generate feed button. You should find the replaced value in the attributes.

How to replace any string from feed

Option 2:

To replace any string use the command [ str_replace => from => to]. Change from and to with your desired string. Copy the command and paste it into the command field of your attribute. Learn more about the commands and their applications from here: How to use a command to format attribute output?

Example 1:  If you want to replace your category separator from >” to “|” your command will be [str_replace => > => | ] .

Example 2:  If you want to replace “,” with “>” then your command will be [str_replace =>comma=>>].

Example 3: To replace ABC with XYZ the command will be: [str_replace => ABC => XYZ]

Note* There is also preg_replace command to replace any string but only developers are recommended to use this command. For example, if you want to replace empty space “ ” with underscore “-” then the command will be [preg_replace /\s+/ -]

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.