Articles on: Shopify

Cost Field

How to Map Cost Field


Import and update unit cost per item (Cost per Item) on Shopify using feed values, custom formulas, delimiter controls, and currency conversions during your feed syncs.


Available on: ✔️ Add | ✔️ Update | ✔️ Export



How to Set Up Cost Field


Go to App → Feed Settings → Step 2: Field Mapping



  1. Map Field: Select the Cost field in Stock Sync.
  2. Open Settings: Click on the Settings (gear icon) next to the mapped field.
  3. Configure Options: Set up condition rules, rounding formats, delimiters, or currency conversion based on your store's requirements.


You can use column values directly in your condition formulas to dynamically calculate product costs.



Cost Field Smart Settings / Detailed Breakdown


1. Cost Conditions


Use cost conditions to automatically calculate and adjust product unit costs during your sync based on specific rules.


Priority Sequence: Conditions take effect according to their top-to-bottom arrangement. The first matching condition has the highest priority. You can reorder them using the side arrows.


Valid Price Range Keywords:

  • price (Use when comparison values are text strings)
  • price_f (Use when comparison values are numeric)
  • col#_f (Use when comparison values are numeric or when parsing from Google Sheets)
  • any (Applies to all products universally)
  • current_price (Shopify store value only)
  • cost (Shopify store value only)
  • compare_at_price (Shopify store value only)


Supported Math & Logic Symbols:


Symbol

Details

==

Equal to

<=

Less than or equal to

>=

More than or equal to

>

More than

<

Less than

and

Only true when both statements are true

or

True when either statement is true


Example Condition Formulas:


Condition (If)

Price / Formula (Then)

Result / Explanation

current_price == 0

*0

If current store cost is 0, multiply by 0 (makes no changes to the cost).

any

*1.5

Multiplies all matched costs by 1.5 (applies a 50% markup).

any

*0 + current_quantity

Multiplies all matched costs by 0, then adds the current_quantity value retrieved from the store.

taxable == 1

*1.5

If the product is taxable (1 = taxable, 0 = untaxable), multiplies the cost by 1.5 (Shopify only).

any

*0 + current_quantity

Multiplies all matched costs by 0, then adds the current_quantity value taken from the store.

col5! = ""

*0 + col5

If column 5 is not empty (has any value), use the value from column 5 as the cost.

any

*0 + (col("price"+80) *1.5

Adds an $80 delivery fee to the stock price, then applies a 50% markup.

any

*0 + current_price*(col("Option2")/100)

Calculates a cost based on the current store price, discounted by the percentage value in column Option 2.

col_string ("Vendor") == "shoe"

*1.3 + col("shipping")

If the "Vendor" column contains "shoe", applies a 30% markup and adds the value from the "shipping" column.

any

col("InStock")

Adds the value from the "InStock" column to the product cost (supported based on XML nodes).

contains ("pink", col_string("Description"))

*1.1

If the "Description" column contains the text "pink", applies a 10% markup. Ideal for string values unsupported by a numerical index.

contains ("4", col("qty"))

*1.5

If the "qty" column contains the number "4", applies a 50% markup. Useful for numerical strings lacking a specific column index.

any

*0 + 12.5

Sets an exact fixed cost of 12.5. Note: You must use *0 + [Value] instead of starting the formula with an equal sign.

price_f > 10 and price_f <= 15

*1.2

Applies a 20% markup if the numerical price is greater than 10 and less than or equal to 15.

price_f == 11

*1.5

Applies a 50% markup if the exact numerical price is 11.

col5 == "shoe"

*1.3

Applies a 30% markup if column 5 specifically equals "shoe". Useful for collection-based markups.

price_f < 1

*0 + current_price

If the numerical price is less than 1, retains the current store price (Shopify only).

price > col1_f

*1 + col1 + col2

If the price is greater than column 1's numerical value, sets the cost to the sum of column 1 and column 2.

Price == "high"

*1.2

Applies a 20% markup if the text price equals "high". Use price when comparison values are text.

any

*0.1

Multiplies all costs by 0.1 (effectively scaling it down to 10% of the original value / a 90% markdown).

price == "discount"

*1.5

Applies a 50% markup if the text price equals "discount".

cost < 40

*1.2

If the product cost in Shopify is less than 40, applies a 20% markup.

compare_at_price > 10

*1.5

If the compare-at price in Shopify is greater than 10, applies a 50% markup.

any

/0.2

Divides all costs by 0.2.

col_string("Vendor")=="CLIF"

*0 + col("Cost")/ 12

If the "Vendor" column contains "CLIF", updates the cost by dividing the "Cost" column value by 12.

col4_date > now

*1.2

If the date in column 4 is in the future compared to current_timestamp (now), applies a 20% markup.

col4_date > today

*1.2

If the date in column 4 is past today's date (today), applies a 20% markup.



2. Cost Delimiter


Select the delimiter format used in your feed file to ensure decimals and thousands are parsed correctly.


Options include Comma, Decimal Point, and Auto.



3. Mapping Cost from Repeating Price Elements


When an XML feed contains multiple <price> elements per product (each containing its own <unit_price>), Stock Sync does not automatically select the lowest or first/last value when element counts vary across items.


Specify the exact element index (e.g., first, second, or third <unit_price>) you want to map. Automatic extraction of the lowest repeating price element is not supported.


4. Cost Round


Standardize your store's product unit costs using rounding rules if numbers appear irregular or require standard formatting.



Rounding Rule

Result / Explanation

##.00 or ##.000

Rounds 12.57 to 12.00, or 12.573 to 12.000

##.#0 or ##.#00

Rounds 12.57 to 12.50, or 12.573 to 12.500

##.## or ##.##0

Rounds 12.57 to 12.57, or 12.573 to 12.570

##.## or ##.###

Retains exact decimals (no changes made, e.g., 12.573 remains 12.573)

##.99

Rounds 12.570 to 12.599

##.95

Rounds 12.57 to 12.95

##.97

Rounds 12.57 to 12.97

##.#99

Rounds 12.570 to 12.599

##9.00

Rounds 121.57 to 129.00

##5.00

Rounds 123.57 to 125.00

##9.99

Rounds 127.57 to 129.99

##,000.00

Rounds 12,453.57 to 12,000.00

##,#00.00

Rounds 12,345.57 to 12,300.00

##,##0.00

Rounds 12,346.57 to 12,350.00

##,#99.00

Rounds 12,345.57 to 12,399.00

##9 (from #.#9 to ##9,000)

Replaces the third digit with a 9, followed by 0s (e.g., 12.57 to 12.90; 145.67 to 149.00)

nearest whole number

Rounds up to the nearest whole integer by adding 1 (e.g., 12.57 to 13.00; 135.33 to 136.00)


5. Currency Converter


Use this if your supplier feed provides costs in a different currency than your Shopify store's default currency.


For example: If your supplier feed currency is MYR and your store currency is USD, enable the Currency Converter and select the appropriate source and target currencies.



6. Don't Update Cost When...


Exclude specific products from having their cost values updated during syncs based on distinct metadata filters.


You can exclude products based on Vendor, Product Type, or Product Tags.


Example: Setting Vendor = Adibas ensures that the cost for any product mapped to vendor "Adibas" will not be modified during syncs.




Key Rules & Technical Details


  • Priority Sequence: Conditions are executed sequentially from top to bottom. Order your highest-priority edge cases at the top of the list.
  • Fixed Value Formula: If setting an exact numerical cost, use *0 + [Value] instead of starting the formula with an = sign.
  • Shopify Cost per Item: Stock Sync updates Shopify's unit cost field (cost_per_item), which feeds into store margin calculations and financial reporting.



Troubleshooting Steps


  • Issue: Cost field shows invalid decimal formatting → Solution: Verify the Cost Delimiter setting and match it to your feed's numeric separator (Comma vs. Decimal Point).
  • Issue: XML feed with multiple price tags imports unexpected cost values → Solution: Specify the exact node index for repeating <unit_price> tags in your feed element settings.



Good Articles to Continue


Updated on: 16/10/2026

Was this article helpful?

Share your feedback

Cancel

Thank you!