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

payment_review, payment_review_kind, payment_review_message

Available with the CartThrob 10 payment-reconciliation update. payment_review is true when the latest checkout needs payment reconciliation. payment_review_kind is confirmed when collection is confirmed, or unknown when the capture outcome could not be established. payment_review_message is the customer-safe review explanation and available payment reference. It does not contain raw gateway diagnostics.

Check this flag before authorized or processing, then show {error_message} and {transaction_id}. These values describe the current submitted-order context; they are not a lookup of an arbitrary order’s reconciliation history. The order total is the intended checkout amount, not necessarily the amount collected during a mismatch.

error_message

The gateway/status error message for the most recent attempt (when available). This is human-readable provider feedback, not a stable status or error code. Its wording can change between gateways, API versions, and locales, and it may contain punctuation or quotation marks that make exact template comparisons fragile.

Display this value when it helps the customer or support staff, but use the status conditionals to decide which result occurred. Do not use an exact error_message comparison, or merely the presence of a message, as the success or failure test.

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}

Financial Result Variables

The submitted order context exposes finalized order-level values and aliases including:

  • {subtotal} and {cart_subtotal}
  • {discount} and {cart_discount}
  • {shipping} and {cart_shipping}
  • {shipping_plus_tax}
  • {tax} and {cart_tax}
  • {subtotal_plus_tax}
  • {total}, {cart_total}, and {total_cart}

In this tag, the cart_* aliases describe the submitted checkout/order result. They are not a fresh reconstruction from the saved item rows.

The finalized total is the intended payable amount. Use the status conditionals, transaction ID, saved order status, and remote gateway record to determine whether payment actually succeeded. An order total can exist for a failed, declined, processing, or abandoned attempt.

order_id

Pulls the ExpressionEngine entry ID of the saved order (when an order entry exists). Same source as {entry_id}. Use this in order_items order_id="", purchased-items links, and invoice URLs.

Depending on Order/Invoice Numbers, these digits can match the invoice ID contained in the title. They are not always the same. For the customer-facing invoice, use {title} or {order_number}.

Order entry ID: {order_id}

order_number

Pulls the invoice ID contained in the order entry title (digits only). Not from the entry ID. {title} is the full title, including prefix and suffix.

Depending on Order/Invoice Numbers, these digits can match {order_id}. They are not always the same.

Invoice 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). Remember: {entry_id} is the EE entry ID; {title} is the full title containing the invoice ID.

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

Conditionals

These are top-level Boolean variables available inside the {exp:cartthrob:submitted_order_info} tag pair. They are not children of error_message, and they are not global template variables. Use them in a mutually exclusive {if} / {if:elseif} chain when rendering the result.

Conditional Resolved order status Recommended use
{if payment_review} Current checkout carries a payment-reconciliation flag Show the review explanation and reference; do not ask for another payment.
{if authorized} authorized or completed Show confirmed-success messaging.
{if processing} Any status not matched by the other three conditions, including pending/offsite-style states Show a pending or still-processing message.
{if declined} declined Show declined-payment guidance and, when useful, {error_message}.
{if failed} failed, refunded, expired, reversed, canceled, or voided Show unsuccessful-payment guidance and, when useful, {error_message}.

For offsite or asynchronous gateways, arriving at the return URL does not by itself prove that payment succeeded. Handle payment_review first; otherwise show confirmed-success messaging when authorized is true. A processing result should remain pending until the gateway result is confirmed; do not fulfill the order based only on the browser return.

{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. This includes pending/offsite-style states and any other status that has not resolved to one of those outcomes.

{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.
  7. Checkout-level overrides can make saved item-row totals differ from the finalized order total. Use the finalized {total} for the intended charge instead of rebuilding it from items.

Examples

Basic checkout result handling:

{exp:cartthrob:submitted_order_info}
    {if payment_review}
        {if payment_review_kind == "confirmed"}
            Payment was received, but your order needs review.
        {if:else}
            We could not confirm the payment outcome.
        {/if}
        {payment_review_message}
        Payment reference: {transaction_id}
    {if:elseif authorized}
        Your payment has been confirmed.
        Transaction ID: {transaction_id}
        Your total: {cart_total}
        Invoice: {title}
        Order entry ID: {order_id}
    {if:elseif processing}
        Your payment is still being confirmed. Please do not submit it again.
        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}

Payment Review Results

CartThrob can place an order in Processing when provider evidence indicates that payment may have been collected but the result cannot be accepted as an ordinary successful checkout. Show payment_review_message and the available order and payment references without prompting the customer to pay again. Apply the same payment_review-first condition to customized Processing notification emails.

Before capturing, refunding, retrying, fulfilling, or requesting another payment, compare the saved Order and payment references with the provider’s records. Mark handled records that operational review; it does not mark the Order paid, fulfill it, issue a refund, or change provider state. See Processing orders and payment reconciliation for the complete merchant workflow.