Knowledge Base
Deviking Product feeds Pro

Conditional Composite Values / Merge Multiple Sources

Add a new Composite Value result type to Dynamic Attributes.

The purpose of this feature is to allow a Dynamic Attribute rule to combine multiple WooCommerce/product sources together with static text and separators, and return the final combined value as the result of the rule.

Result Types

Dynamic Attribute rules should support:

 
Result Type:

○ Static Value
○ Source Field
○ Composite Value
 

The same result types should also be available for the ELSE / Default Result where applicable.


Composite Value

When Composite Value is selected, display a field where the user can build the final output using static text and dynamic source placeholders.

Example:

 
{{source:name}} - {{source:attr:pa_color}}
 

For a product with:

 
Name: Running Shoes
Color: Blue
 

the result should be:

 
Running Shoes - Blue
 

The feature must use the existing Deviking source resolver so all supported product sources can be used.

Examples:

 
{{source:name}}
{{source:sku}}
{{source:price}}
{{source:currency}}
{{source:attr:pa_color}}
{{source:attr:pa_size}}
{{source:meta:_gtin}}
{{source:tax:product_brand}}
{{source:parent:description}}
 

Dynamic Attribute sources should also be supported where recursion can be handled safely.


Multiple Sources

A Composite Value must allow more than two sources.

Example:

 
{{source:name}} - {{source:attr:pa_color}} - {{source:attr:pa_size}}
 

Result:

 
Running Shoes - Blue - 44
 

Another example:

 
{{source:sku}} | {{source:name}} | {{source:tax:product_brand}}
 

Result:

 
SHOE-001 | Running Shoes | Nike
 

There should be no artificial limit of two fields.


Static Text

Static text can appear anywhere in the Composite Value.

For example:

 
SKU: {{source:sku}} - {{source:name}}
 

Result:

 
SKU: SHOE-001 - Running Shoes
 

Another example:

 
{{source:name}} (Color: {{source:attr:pa_color}}, Size: {{source:attr:pa_size}})
 

Result:

 
Running Shoes (Color: Blue, Size: 44)
 

Static content may include:

 
spaces
-
/
|
:
()
[]
custom words
 

Conditional Composite Values

The main purpose of this feature is to combine the existing IF / ELSE Dynamic Attribute logic with multi-source output.

Example:

 
Dynamic Attribute:
Feed Product Title
 

Rule:

 
IF
Child Category = Shoes

RESULT TYPE
Composite Value

VALUE
{{source:name}} - {{source:attr:pa_color}} - {{source:attr:pa_size}}
 

Default:

 
ELSE

RESULT TYPE
Source Field

SOURCE
Name / Title
 

Result:

 
Shoes product:
Running Shoes - Blue - 44

Other product:
Leather Wallet
 

The product data stored in WooCommerce must remain unchanged. The composite value exists only during feed generation.


Different Composite Values per Rule

Each Dynamic Attribute rule can return a different Composite Value.

Example:

 
Rule 1

IF
Child Category = Shoes

→ {{source:name}} - {{source:attr:pa_color}} - {{source:attr:pa_size}}
 
 
Rule 2

IF
Child Category = Clothing

→ {{source:name}} - {{source:attr:pa_color}}
 
 
ELSE

→ {{source:name}}
 

Possible results:

 
Running Shoes - Blue - 44
T-Shirt - Black
Coffee Machine
 

Composite Value as Default Result

The ELSE / Default Result should also support Composite Value.

Example:

 
Rule 1

IF
Featured = yes

→ Featured: {{source:name}}
 

Default:

 
ELSE

Composite Value:
{{source:name}} - {{source:sku}}
 

This gives:

 
Featured: Running Shoes
 

or:

 
Leather Wallet - WALLET-021
 

Empty Source Handling

Composite Values need predictable handling when one of the included sources is empty.

Add:

 
Empty Source Handling:

○ Keep structure
○ Skip empty parts
 

Keep structure

Template:

 
{{source:name}} - {{source:attr:pa_color}} - {{source:attr:pa_size}}
 

If Size is empty:

 
Running Shoes - Blue -
 

Skip empty parts

With the same data, the result should become:

 
Running Shoes - Blue
 

This option should avoid unnecessary trailing or repeated separators when possible.

Skip empty parts should be the recommended/default behavior.


Optional Separator Builder

For easier configuration, Composite Value can support a visual source builder in addition to manual placeholders.

For example:

 
[ Name / Title ]
[ Static: " - " ]
[ Color ]
[ Static: " - " ]
[ Size ]
 

Resulting internally in:

 
{{source:name}} - {{source:attr:pa_color}} - {{source:attr:pa_size}}
 

Each component should support:

 
Source Field
Static Text
 

and components should be reorderable.

The stored value should remain a normal source-template expression so it can be processed by the existing resolver.


Variation Support

Composite Values must be evaluated against the current feed record.

For variation feeds:

 
Parent:
Running Shoes

Variation:
Blue / 44
 

Template:

 
{{source:name}} - {{source:attr:pa_color}} - {{source:attr:pa_size}}
 

should resolve using the variation-aware source behavior:

 
Running Shoes - Blue - 44
 

Parent sources can still be explicitly requested through:

 
parent:<source>
 

when required.


Mapping Integration

After saving the Dynamic Attribute, it should continue to appear normally in Mapping as:

 
dynamic:<id>
 

Example:

 
Output Field:
title

Source:
Feed Product Title
 

No additional Mapping-specific handling should be required.

The Dynamic Attribute resolves the final Composite Value first, and the Mapping row then continues through its normal processing pipeline.


Mapping Transformations

Composite Dynamic Attribute results must remain compatible with existing Mapping transformations.

Example:

 
Dynamic Attribute result:
Running Shoes - BLUE
 

Mapping:

 
Source:
Feed Product Title

Transform:
Lowercase
 

Output:

 
running shoes - blue
 

The normal Mapping resolution order remains applicable after the Dynamic Attribute has returned its value.


Difference from Prefix / Suffix

Existing dynamic Prefix/Suffix placeholders must remain unchanged.

They are useful for simple combinations such as:

 
Source:
Current Price

Suffix:
 {{source:currency}}
 

Result:

 
19.90 EUR
 

Composite Value is intended for more advanced cases where:

  • multiple sources must be combined;
  • the source order is flexible;
  • static text can appear between several fields;
  • different combinations are required depending on Dynamic Attribute conditions.

For example:

 
IF Category = Shoes
→ {{source:name}} - {{source:attr:pa_color}} - {{source:attr:pa_size}}

ELSE
→ {{source:name}}
 

This cannot be represented cleanly by a normal Mapping Prefix/Suffix alone.


Example Use Cases

The feature should support scenarios such as:

 
Product Title + Color
 
 
Product Title + Color + Size
 
 
Brand + Product Name + SKU
 
 
Category + Product Name
 
 
MPN + Brand
 
 
Product Name + custom meta field
 
 
Parent Title + variation attributes
 

and any other combination of supported Deviking sources.


Example: Supplier Product Description

 
IF
Stock Status = instock

RESULT:
Composite Value

{{source:sku}} - {{source:name}} - Stock: {{source:stock_quantity}}
 

Possible output:

 
ABC-100 - Running Shoes - Stock: 18
 

Example: Variation Title

 
Composite Value:

{{source:name}} - {{source:attr:pa_color}} / {{source:attr:pa_size}}
 

Possible output:

 
Running Shoes - Blue / 44
 

Example: Brand and MPN

 
Composite Value:

{{source:tax:product_brand}} {{source:meta:_mpn}}
 

Possible output:

 
Acme AC-4582
 

Validation

Dynamic Attribute validation should detect invalid Composite Value configurations.

Validation should check:

 
At least one valid source or static value exists
Source placeholders use valid syntax
Unknown source tokens are reported
Circular Dynamic Attribute references are rejected
 

A Dynamic Attribute must not be allowed to directly or indirectly reference itself.


Preview

The Dynamic Attribute editor should provide a Preview of the resolved Composite Value where practical.

At minimum, normal Feed Preview must show the final resolved output exactly as it will appear in the generated feed.


Final Processing Model

With this addition, Dynamic Attribute output becomes:

 
Conditions
    ↓
First matching rule
    ↓
Result Type
    ├── Static Value
    ├── Source Field
    └── Composite Value
            ↓
       Resolve {{source:...}} placeholders
            ↓
       Handle empty components
            ↓
       Return final value
 

Then the normal Mapping processing continues:

 
Dynamic Attribute result
→ Mapping Transform
→ Prefix / Suffix
→ XML / CSV output