sm_customer_key | STRING | Customer key from dim_orders when matched. Null when is_order_matched = FALSE. |
sm_order_key | STRING | Order key from dim_orders when the return matched a Shopify order. Null when is_order_matched = FALSE. |
sm_return_key | STRING | Surrogate key for the return event (sm_store_id + source_system + return_id). source_system participates because Loop return ids and ReturnGO rma_ids are both bare integers from independent sequences and would otherwise collide for a workspace running both vendors. |
sm_store_id | STRING | SourceMedium store identifier. Unique per workspace. |
customer_email | STRING | Email on the return record. NULL for ReturnGO and native Shopify, whose extracted headers carry no customer identity. |
days_to_return | INT64 | Calendar days from order_created_at to return_created_at; null if order unmatched or the source has no return timestamp. |
exchange_product_total | NUMERIC | Exchange product subtotal. NULL for ReturnGO; see exchange_total. |
exchange_total | NUMERIC | Exchange merchandise total. NULL for ReturnGO, which records exchanges as item resolutions with no monetary total. |
gift_card_amount | NUMERIC | Store credit / gift card amount. ReturnGO: settled RefundToGiftCard transactions attributed to the return, 0 when there are none. Note ReturnGO’s RefundToStoreCredit transactions carry no return_item_ids, so store credit specifically is visible in has_credit but not in this amount. |
handling_fee_amount | NUMERIC | Merchant-retained fee on the return. ReturnGO itemises three (return, shipment, restocking); they are summed into this one column. All three are 0 across DAX’s loaded history, so the mapping is documented rather than measured. |
has_credit | BOOL | Whether the return resolved to store credit or a gift card. Derived per vendor; see has_refund. |
has_exchange | BOOL | Whether the return involved an exchange. Derived per vendor; see has_refund. |
has_refund | BOOL | Whether the return involved a refund to the original payment method. Derived by each vendor’s adapter from its own native signal (Loop: its outcome string; ReturnGO: any item resolving RefundToPaymentMethod), NOT by substring-matching return_outcome, that test could only ever be correct for Loop. |
has_upsell | BOOL | Whether the customer paid a price difference. NULL for ReturnGO: its upsell analogue is the InvoicePayment transaction, and every one of those carries a NULL return_item_ids, so whether a GIVEN return had one is genuinely unknown. |
is_child_order_return | BOOL | True when the order being returned is itself an exchange child order (EXC- prefix on return_order_name). Not a proxy for has_exchange: only 16,445 of TPJ’s 142,300 exchange-outcome returns carry the prefix. False for every ReturnGO row today. |
is_order_matched | BOOL | True when a dim_orders row was found for shopify_order_id + sm_store_id + Shopify. When false, all order-context fields are null. |
loop_order_name | STRING | DEPRECATED, use return_order_name, which carries the same value and is populated for every returns platform. This column is Loop Returns only and is NULL on rows from any other platform. It is held identical to return_order_name by fct_returns_loop_order_name_alias_matches_return_order_name and will be removed once no consumer reads it. |
net_return_cost | NUMERIC | Net cost of the return to the brand: refund_amount + gift_card_amount - upsell_amount Unknown components are treated as zero when any component is known. NULL when all three components are unknown, including native Shopify returns. Positive value = net cost to brand. |
order_created_at | TIMESTAMP | Matched Shopify order created_at from dim_orders. Null when is_order_matched = FALSE. |
order_index | INT64 | Customer order index from dim_orders when matched (1 = first order). Null when is_order_matched = FALSE. |
order_name | STRING | Shopify order name from dim_orders when matched. Null when is_order_matched = FALSE. |
order_processed_at_local_datetime | DATETIME | Matched order processed datetime in reporting timezone. Null when is_order_matched = FALSE. |
order_sequence | STRING | First vs repeat order sequence from dim_orders when matched. Values: 1st_order, repeat_order. Null when is_order_matched = FALSE. |
origin_country_code | STRING | Return origin country code. NULL for ReturnGO and native Shopify, which do not report it. |
refund_amount | NUMERIC | Cash refunded to the customer. ReturnGO: the sum of settled (Success) RefundToPaymentMethod transactions attributed to the return, and 0 when there are none, every such transaction carries a return_item_ids linkage, so the attributed set is the complete refund ledger and zero genuinely means no cash moved. A Canceled RMA reads 0 here while still reporting has_refund, because the refund resolution is what the customer requested before the return was cancelled. test_returngo_closed_refund_has_transaction catches the one anomalous shape: a closed refund return with no transaction behind it. |
return_created_at | TIMESTAMP | When the customer initiated the return. NULL for native Shopify returns because the extracted Return node exposes no timestamp. |
return_currency | STRING | Currency for return financials. |
return_discount_total | NUMERIC | Discounts on returned items. NULL for ReturnGO, which has no item discount field. |
return_id | STRING | The returns platform’s own return identifier (Loop id, ReturnGO rma_id, or Shopify Return id). |
return_order_name | STRING | Display name of the order being returned, as the returns vendor recorded it (#12345, or EXC-12345-1 for a Loop-created exchange child order). |
return_outcome | STRING | Canonical outcome label: the ’+‘-joined set of atoms the return exhibits, in the order exchange, refund, credit, upsell. Derived from the four booleans rather than passed through, so both vendors read alike; verified byte-identical to Loop’s native outcome on all 292,842 TPJ returns. NULL when a return exhibits no atom at all. |
return_product_total | NUMERIC | Returned product subtotal. ReturnGO: the sum of what the customer originally paid for the returned items, which reconciles exactly to its attributable refund transactions. |
return_reason | STRING | Dominant line-level reason rolled up to return grain (largest returned quantity, ties broken alphabetically). Vendor-native vocabulary, not normalised across vendors: Shopify’s ReturnReason enum (10 values, 100% line coverage), Loop’s specific reason, ReturnGO’s customer-selected reason. NULL when no line carries a reason. |
return_state | STRING | Canonical return state, normalised across vendors by returns_canonical_state(): open, closed, expired (Loop only), cancelled, or rejected. NULL when the vendor sent a state the mapping does not recognise, visible by design, rather than passing an unknown value through to a customer view. |
return_state_native | STRING | The returns platform’s own state spelling, before normalisation into return_state (Loop Returns: open/closed/expired; ReturnGO: Approved/Done/Canceled/Rejected; Shopify: REQUESTED/OPEN/CLOSED/DECLINED/CANCELED). Use it when return_state is NULL, which means the platform reported a state this model does not yet recognise. |
return_tax_total | NUMERIC | Tax on returned items. |
return_total | NUMERIC | Total gross value of the return. Loop reports it directly; for ReturnGO it is rebuilt as return_product_total + return_tax_total, since that API has no return-level total. |
return_type | STRING | Vendor return type. Loop reports ‘standard’; ReturnGO and native Shopify have no such concept (NULL). |
return_updated_at | TIMESTAMP | Last source update on the return. NULL for native Shopify because the extracted Return node exposes no timestamp. |
return_week_bucket | STRING | Bucketed days from order to return initiation. Values: 0-7 days, 8-14 days, 15-21 days, 22-30 days, 31-45 days, 46-60 days, 60+ days. Null when is_order_matched = FALSE or the source has no return timestamp. |
shopify_order_id | STRING | Shopify order id; join key to dim_orders.order_id for Shopify rows. |
sm_channel | STRING | SM channel on the matched order. Null when is_order_matched = FALSE. |
sm_sub_channel | STRING | SM sub-channel on the matched order. Null when is_order_matched = FALSE. |
source_system | STRING | Which returns platform produced this row. Internally ‘Loop Returns’, ‘ReturnGO’, or ‘Shopify’; the published copy normalises these to lowercase snake_case (loop_returns, returngo), the same convention obt_orders.source_system follows (Shopify -> shopify), so a delivered query should match on the lowercase form. |
upsell_amount | NUMERIC | Additional amount collected from the customer. NULL for ReturnGO: its InvoicePayment transactions all carry a NULL return_item_ids and so cannot be tied to a return. Zero would assert no upsell occurred when 24 such transactions demonstrably exist. |