With ExportFeed, it is possible to customize your data feeds using the advanced commands. Here are the advanced commands that could be useful to make automatic changes in your data feeds. These commands are to be copied inside the “Advanced Commands” box.Advanced Commands grant you more control over your feeds. They provide a way to create your own attribute, map from non-standard ones or modify and delete feed data.
Configure the default value for an attribute. This is especially helpful when creating new
setAttributeDefault attribute_name as “value”
setAttributeDefault brand as ABC
mapAttribute brand to g:brand
This will map the attribute value for brand to Brand_name. In your feed, you will get an attribute “Brand_name” retaining the value for “brand”.
mapAttribute attribute1 to attribute2
Example: mapAttribute brand to Brand_name
This will help you delete the attributes you want. Once deleted, the attribute will no more be present in the feed.
example: deleteAttribute regular_price
Delete all attributes:
4. rule concat():
This command will basically concatenate two values to make it one. For example: For your variation product, the title will be same. So if you would like to get different title, you can concatenate title with the variation base like color, size, material, etc.
rule concat(string1, string2, string3, …) as name
example: rule concat(title, color) as new_title
setAttributeDefault title as $new_title
5. Limit products in a feed:
Sometimes, due to huge number of products, the feed might stuck in certain percentage. So limiting product in a feed might help in such case.
limitOutput FROM low TO high
example: limitOutput FROM 0 TO 5000
6. Map Attributes imported from another plugin:
Consults the Taxonomy table and fills in attribute information from it. Ideal for mapping data
stored in 3 party plugins. This is a command to use rd if even ProductListXML cannot see the field of interest and the entry in the taxonomy table (source) is known.At the time of writing, this command only works in WordPress. Other CMS ports will ignore it.
mapTaxonomy source as attribute
example: mapTaxonomy brand as g:brand
7. Set some values:
set value as parameter
example: set currency as USD
8. rule discount():
This command is basically used to bring changes in the price in a feed. If you want to add a discounted price on feed or increase price only in the feed then this rule can be used.
rule discount(5) -> Take 5 dollars off
rule discount(5, s) -> Take 5 dollars off sale price (if sale given – if sale not given, do not apply discount)
rule discount(0.95, *) -> Take 95% of price (5% discount)
rule discount(0.95, *, s) -> Take 95% of sales price (5% discount)
9. FindAndSet Rule:
This rule is used when we have to set values for one attribute in relation to another attribute.
rule findAndSet(attribute1, “value”, attribute2, “value”)
Example: rule findAndSet(sku, “12345abcd”, valid, false)
10. Rules for setting shipping attribute:
rule shipping(5) -> Shipping cost is $5(Flat rate)
rule shipping(0.95, *) -> Shipping is 95% of the full price
rule shipping(0.95, *, s) -> Shipping is 95% of the sale price
rule shipping(grnd|air, t) -> Treat the numeric value as a decimal percentage
rule description(parameter1, parameter2, …)
Modifies a product description
Note: There is only ever one description rule. When two or more description rules co-exist, the
most recent overwrites the others.
Note: description( ) accepts parameters in any order
Trims the product description to 50 characters.
rule description(long, strict, replacement_character = _ )
Forces the description to use the long format is available (as opposed to an excerpt).
Enables replacement of special characters
Sets the replacement value to an underscore
List of parameters
long -> Force long description
short -> Force product excerpt
length -> Synonymous to maximum_length
maximum_length=x -> trim output to x characters
replacement_character = x -> when using strict mode, use x as the replacement character
strict -> disallow special characters and control characters
allow_empty_title -> never substitute description into title
12. Remove attribute condition:
example: rule removeAttributeCondition(regular_price,”>”,10000)
Removes attributes with regular_price greater than $10000.
13. Remove Empty (blank) Attributes:
rule removeEmptyAttributes(attribute-slug or custom field)
example: rule removeEmptyAttributes(regular_price)
Result: This will remove the attributes with no regular_price information.
Pulls WooCommerce shipping attributes: length, width & height into attributes: “length”, “width” & “height” respectively
example: set get_wc_shipping_attributes as true
15. Hide out of stock:
Hides/removes out of stock items from the feed.
sets the max custom fields to 5000. May resolve some feed generation issues.
example: $max_custom_field = 50000
17. set attribute_granularity:
Sometimes, the plugin retains the previously stored value for an attribute on database. That is why, in some cases, the attributes like gender, age_group, etc. will have the value as “default”. In that case, this command will help to remove the value.
example: set attribute_granularity to 0
This command will help to ignore the duplicate products in a feed.
Sets PHP execution timeout.
example: $timeout = 300
Return the numeric location(0-based) of needle within haystack.
rule pos(haystack, needle) as name
rule pos(description, “cars”) as index
rule substr(description, $index, 80) as reduced_description
setAttributeDefault my_custom_attribute as reduced_description
Title is equal to description from the word “car” and the next 80 characters.