Knowledge Base
Deviking Product feeds Pro

Using a Fallback Source When a Product Field Is Empty

Product data is not always stored consistently across an entire WooCommerce catalog.

For example, some products may have a Short Description, while others only have a full Description. Some products may have a Sale Price, while others only have a Regular Price.

Deviking Product Feeds Pro can automatically use a second source whenever the primary source is empty.

This is handled directly in the feed Mapping with Fallback Source. A Dynamic Attribute is not required for a simple “use A, otherwise use B” rule.


How Fallback Source Works

Each Mapping row can contain:

 
Source:
Primary value

Fallback Source:
Backup value
 

During feed generation, Deviking Product Feeds first resolves the primary Source.

If the primary Source contains a value, that value is used.

If the primary Source is empty, the plugin resolves the Fallback Source instead.

The basic logic is:

 
Source has a value
→ Use Source

Source is empty
→ Use Fallback Source
 

Example: Short Description with Description as Fallback

Suppose you want the feed’s description field to use the WooCommerce Short Description whenever it exists.

For products without a Short Description, you want to use the full Description instead.

Open:

Deviking Feeds → Feeds

Edit the required feed and go to Mapping.

Configure:

 
Output Field:
description

Source:
Short Description

Fallback Source:
Description
 

The result is:

 
Product A

Short Description:
Lightweight running shoe.

Description:
A complete description of the running shoe...

Feed result:
Lightweight running shoe.
 

But if another product has:

 
Product B

Short Description:
(empty)

Description:
Premium leather walking shoe with rubber sole.

Feed result:
Premium leather walking shoe with rubber sole.
 

The fallback is used automatically.


XML Example

Configuration:

 
Output Field:
description

Source:
Short Description

Fallback Source:
Description
 

A product with a Short Description could generate:

 
<description>Lightweight running shoe.</description>
 

while a product without one could generate:

 
<description>Premium leather walking shoe with rubber sole.</description>
 

No separate rule needs to be created for each product.


CSV Example

The same configuration works with CSV feeds:

 
sku,title,description
SHOE-001,"Running Shoe","Lightweight running shoe."
SHOE-002,"Walking Shoe","Premium leather walking shoe with rubber sole."
 

The source used for each row is determined automatically during generation.


Example: Sale Price with Regular Price as Fallback

Fallback Source is especially useful for prices.

Suppose you want to export the Sale Price whenever a product is on sale, but use the Regular Price when no Sale Price exists.

Configure:

 
Output Field:
price

Source:
Sale Price

Fallback Source:
Regular Price
 

For a product with:

 
Regular Price:
100.00

Sale Price:
79.00
 

the feed value becomes:

 
79.00
 

For a product with:

 
Regular Price:
100.00

Sale Price:
(empty)
 

the feed value becomes:

 
100.00
 

Apply a Transform After the Fallback Is Resolved

The selected value can still use the normal Mapping Transform.

For example:

 
Output Field:
price

Source:
Sale Price

Fallback Source:
Regular Price

Transform:
Number Format
 

with:

 
Decimals:
2

Decimal separator:
Dot

Thousands separator:
None
 

If Sale Price is:

 
79
 

the result can become:

 
79.00
 

If Sale Price is empty and Regular Price is:

 
100
 

the result can become:

 
100.00
 

The same Transform is applied regardless of whether the final value came from the Source or Fallback Source.


Processing Order

Mapping fields are processed in the following order:

 
Source
↓
Fallback Source, only if Source is empty
↓
Transform
↓
Prefix / Suffix
↓
Feed output
 

This is important when formatting or modifying the resolved value.

For example:

 
Source:
Sale Price

Fallback Source:
Regular Price

Transform:
Number Format

Suffix:
 {{source:currency}}
 

could produce:

 
79.00 EUR
 

or, when Sale Price is empty:

 
100.00 EUR
 

Use Fallback with Product Attributes

Fallback Source is not limited to descriptions or prices.

You can use any appropriate available source.

For example, a store may contain brand information in different places.

You could configure:

 
Output Field:
brand

Source:
Product Brand

Fallback Source:
Brand
 

Products that contain the primary brand value use it directly.

Products where that source is empty use the fallback Brand source.


Use Fallback with Custom Fields

Detected product and variation meta fields can also be used as sources.

For example:

 
Output Field:
gtin

Source:
meta:_gtin

Fallback Source:
meta:_global_unique_id
 

The exact meta keys depend on the WooCommerce site and the plugins storing the product data.

When possible, select the required field directly from the Source selector.


Use Fallback with Product Attributes and Taxonomies

Available sources can also include WooCommerce attributes and custom taxonomies.

For example:

 
Source:
tax:product_brand

Fallback Source:
attr:pa_brand
 

This can be useful when part of the catalog uses a brand taxonomy while older products use a WooCommerce Brand attribute.


What Happens If Both Sources Are Empty?

If both the primary Source and Fallback Source resolve to an empty value, the final mapped value remains empty.

For example:

 
Source:
Short Description

Fallback Source:
Description
 

and both fields are empty:

 
Short Description:
(empty)

Description:
(empty)
 

There is no value available to export.

If you need a fixed value when both sources are empty, use a Dynamic Attribute with an appropriate ELSE / Default Result.


When to Use Fallback Source

Use Fallback Source whenever the logic is simply:

 
Use A if available
otherwise use B
 

Typical examples include:

 
Short Description
→ Description
 
 
Sale Price
→ Regular Price
 
 
Primary Brand
→ Brand Attribute
 
 
Primary GTIN field
→ Secondary GTIN field
 
 
Custom field A
→ Custom field B
 

This is the simplest solution and keeps the Mapping configuration easy to understand.


When to Use a Dynamic Attribute Instead

Use a Dynamic Attribute when the decision depends on actual conditions rather than whether a field is empty.

For example:

 
IF Stock Status = instock
→ return one source

ELSE
→ return another source
 

or:

 
IF Child Category = Shoes
→ return one value

ELSE
→ return another value
 

For a simple empty-field fallback, creating a Dynamic Attribute is unnecessary.


Fallback Source vs Value Map

These features solve different problems.

Fallback Source chooses another field when the first field is empty:

 
Sale Price empty
→ Regular Price
 

Value Map changes an existing value:

 
instock
→ available
 

They can also be used together because the Fallback Source is resolved before the Transform is applied.

For example:

 
Source:
Primary Availability Field

Fallback Source:
Stock Status

Transform:
Value Map
 

The resolved value can then be converted by the Value Map.


Fallback Source vs Prefix / Suffix

Prefix and Suffix do not provide fallback behavior.

For example:

 
Source:
Current Price

Suffix:
 {{source:currency}}
 

combines values:

 
19.90 EUR
 

while:

 
Source:
Sale Price

Fallback Source:
Regular Price
 

selects between two possible sources.

These features can be combined in the same Mapping row when required.


Example: Complete Price Configuration

A practical feed price mapping could be:

 
Output Field:
price

Source:
Sale Price

Fallback Source:
Regular Price

Transform:
Number Format

Decimals:
2

Decimal separator:
Dot

Thousands separator:
None

Suffix:
 {{source:currency}}
 

For a discounted product:

 
Regular Price:
100

Sale Price:
79

Currency:
EUR
 

result:

 
79.00 EUR
 

For a product without a Sale Price:

 
Regular Price:
100

Sale Price:
(empty)

Currency:
EUR
 

result:

 
100.00 EUR
 

Preview the Fallback Behavior

After configuring the Mapping:

  1. Save the feed.
  2. Run Preview.
  3. Check a product where the primary Source contains a value.
  4. Check a product where the primary Source is empty.
  5. Confirm that the expected Fallback Source is used.
  6. Check any configured Transform, Prefix or Suffix.
  7. Run Validate Feed.
  8. Use Save & Generate when the output is correct.

Recommended Configuration

For the common description example:

 
Output Field:
description

Source:
Short Description

Fallback Source:
Description
 

For prices:

 
Output Field:
price

Source:
Sale Price

Fallback Source:
Regular Price
 

For brand information:

 
Output Field:
brand

Source:
Product Brand

Fallback Source:
Brand
 

Whenever the requirement is simply “use this field, but if it is empty use another field”, the built-in Fallback Source is the appropriate solution.