CartThrob 9 documentation for ExpressionEngine commerce teams Visit CartThrob.com
CartThrob.com

Submitted Order Info

submitted_order_info returns details from the most recent checkout attempt stored in the cart order context, and (when available) merges in saved order entry variables.

Use this tag on your checkout return/result page to show success/failure messaging and key order information.

See also:

Parameters

This tag has no tag-specific parameters.

Variables

error_message

The gateway/status error message for the most recent attempt (when available).

Your payment failed: {error_message}

transaction_id

Gateway transaction reference for the most recent attempt.

Transaction ID: {transaction_id}

cart_total

Formatted order/cart total stored with the submitted order context.

Your total: {cart_total}

order_id

Saved order entry ID (when an order entry exists).

Your order ID: {order_id}

order_number

Digits-only version of the order title.

Order Number: {order_number}

order_items:total_results

Total number of line items in the stored order items payload.

Total number of purchased items: {order_items:total_results}

custom_data:key

Custom order/cart data values are flattened for direct output.

Referral source: {custom_data:source}

Order Entry Fields

If order_id points to an existing saved order entry, this tag also parses entry variables from that order (for example entry_id, title, entry_date, and mapped order fields such as order_total, order_shipping, etc., depending on your channel setup).

The tag also adds cart_-prefixed aliases for its base order-context keys.

Conditionals

{if authorized}

True when order status resolves to authorized or completed.

{if authorized}Payment successful{/if}

{if processing}

True when order status is neither authorized/completed, declined, nor a failed-like status.

{if processing}Your payment is still processing{/if}

{if declined}

True when order status resolves to declined.

{if declined}Your card was declined{/if}

{if failed}

True when order status resolves to one of: failed, refunded, expired, reversed, canceled, or voided.

{if failed}Your payment failed{/if}

{if no_results}

Shown when no submitted order data is available for the current session/context.

{if no_results}
    No recent checkout attempt was found.
{/if}

Behavior and Constraints

  1. Reads data from ee()->cartthrob->cart->order().
  2. If an order_id exists and the order entry is found, merges channel entry variables for that order.
  3. transaction_id and error_message are pulled from order auth data first, with fallback to order status storage.
  4. Status flags are normalized from order status:
    • authorized for authorized or completed
    • declined for declined
    • failed for failed, refunded, expired, reversed, canceled, voided
    • processing for everything else
  5. Arrays that are not row-style arrays are removed from direct parse output; custom_data is flattened to custom_data:key.
  6. This tag reports the last attempted order context for the current cart/session flow; it does not query arbitrary historical orders by parameter.

Examples

Basic checkout result handling:

{exp:cartthrob:submitted_order_info}
    {if authorized}
        Your payment is a success!
        Transaction ID: {transaction_id}
        Your total: {cart_total}
        Your order ID: {order_id}
    {if:elseif processing}
        Your transaction is being processed.
        Transaction ID: {transaction_id}
    {if:elseif declined}
        Your credit card was declined: {error_message}
    {if:elseif failed}
        Your payment failed: {error_message}
    {if:else}
        No recent checkout attempt was found.
    {/if}
{/exp:cartthrob:submitted_order_info}

Using saved order entry fields (when orders are saved as entries):

{exp:cartthrob:submitted_order_info}
    <h2>Order {title}</h2>
    <p>Date: {entry_date format="%M %d, %Y"}</p>
    <p>Items: {order_items:total_results}</p>
    <p>Total: {order_total}</p>
{/exp:cartthrob:submitted_order_info}