Search documentation v0.9.0

Order Details Block for Astro

Display order summaries to users

Source ↗️ Report Issue ↗️

Use the OrderDetails component to present users with a summary of their order, including product information, pricing, status, and invoice. They provide a streamlined user experience by making it easy for users to track their order’s progress or access receipts.

Amount paid
$6.00 Paid on November 07, 2024 See product details
Transaction details
Your transaction has been completed successfully. Thank you for your purchase! We have emailed you details of your order. You can download your product below.
  • Order ID
    1pxjyv0v
  • Invoice number
    6876-10027
  • Product
    Webcore
  • Payment method
    visa ending in 5556 (Expires: 2025/1)
Unlock code
How to use the OrderDetails component in Astro
---
const orderDetailsProps = {
img: {
src: '/product-image.png',
alt: 'Product image alt text',
height: 215,
width: 350
},
price: '$6.00',
paidOn: 'November 07, 2024',
productDetailsLink: {
text: 'See product details',
href: '#'
},
orderId: '1pxjyv0v',
product: 'Webcore',
invoiceNumber: '6876-10027',
paymentMethod: 'visa ending in 5556 (Expires: 2025/1)',
cta: {
text: 'Download'
}
}
---
<OrderDetails {...orderDetailsProps}>
<span class="muted">Your transaction has been completed...</span>
</OrderDetails>

The OrderDetails component is split into two sections:

The details of the order inside the main section is split into two columns. This information is displayed in a single column if there are only 1 or 3 details provided for the component. You can change this behavior in the component here.

Inside the component you can specify any element to customize the body of your order details card. For example, you can use a Stepper component to visualize next steps for the user:

Amount paid
$6.00 Paid on November 07, 2024 See product details
Transaction details
Your transaction has been completed successfully. Thank you for your purchase! We have emailed you details of your order. You can download your product below. Here are the next steps:
  1. Download and loginUse your checkout email
  2. Read our introductionReview key concepts
  3. LaunchStart using with clients

  • Order ID
    1pxjyv0v
  • Invoice number
    6876-10027
  • Product
    Webcore
  • Payment method
    visa ending in 5556 (Expires: 2025/1)
Unlock code
How to customize the body of your order details
---
import { Stepper } from 'webcoreui/astro'
const orderDetailsProps = { ... }
const steps = [
{
title: 'Download and login',
subTitle: 'Use your checkout email',
icon: lockOpen, // Make sure to import your custom SVG icons
active: true
},
{
title: 'Read our introduction',
subTitle: 'Review key concepts',
icon: 'file'
},
{
title: 'Launch',
subTitle: 'Start using with clients',
icon: rocketIcon
}
]
---
<OrderDetails {...orderDetailsProps}>
<div class="grid">
<span class="muted">Your transaction has been completed successfully...</span>
<Stepper items={steps} />
<hr />
</div>
</OrderDetails>

Don’t forget to import your SVG icons if you use the Stepper component with custom icons. You can read more about how to use the Stepper component in its documentation.

Translations

You can use the translations prop to translate the text for each hard-coded label:

Product price
$6.00 Completed on November 07, 2024 See product details
Order with custom translations
Your transaction has been completed successfully. Thank you for your purchase! We have emailed you details of your order. You can download your product below.
  • Your Order's ID:
    1pxjyv0v
  • Your Invoice:
    6876-10027
  • Product Name:
    Webcore
  • Your Payment Details:
    visa ending in 5556 (Expires: 2025/1)
Unlock code
How to translate the component
---
const orderDetailsProps = { ... }
const translations = {
amountPaid: 'Product price',
paidOn: 'Completed on',
transactionDetails: 'Order with custom translations',
orderId: 'Your Order\'s ID:',
product: 'Product Name:',
invoiceNumber: 'Your Invoice:',
paymentMethod: 'Your Payment Details:'
}
---
<OrderDetails {...orderDetailsProps} translations={translations}>
<span class="muted">Your transaction has been completed...</span>
</OrderDetails>

You can overwrite the default translations of the component in the component’s file by changes the values specified in the i18n variable.

API

Unlock code
Component API reference
type OrderDetailsProps = {
title?: string
img?: {
src: string
alt: string
width: number
height: number
lazy?: boolean
}
price: string
paidOn?: string
productDetailsLink?: {
text: string
href: string
target?: '_self'
| '_blank'
| '_parent'
| '_top'
| '_unfencedTop'
}
orderId?: string
product?: string
invoiceNumber?: string
paymentMethod?: string
cta?: ({
text: string
icon?: string
} & ButtonProps)
translations?: {
amountPaid?: string
paidOn?: string
transactionDetails?: string
orderId?: string
product?: string
invoiceNumber?: string
paymentMethod?: string
}
className?: string
}
Please see the documentation of the Button component for the ButtonProps type.
PropPurpose
title Sets a title for the page where the component is used.
img Specifies an image for the order.
img.url Sets the path for the image.
img.alt Sets an alternate text for the image.
img.width Sets the width of the image.
img.height Sets the height of the image.
img.lazy Set to true to lazy load the image.
price Sets the price of the order.
paidOn Sets the date when the order was fulfilled
productDetailsLink Provides a link back to the page of the ordered product.
orderId Sets the ID of the order that is displayed for reference to the user.
product Sets the name of the product shown next to the order ID.
invoiceNumber Sets the invoice number, shown under the order ID.
paymentMethod Sets the payment method, shown next to the invoice.
cta Sets a CTA button at the bottom of the order details.
cta.text Sets the label for the CTA.
cta.icon Sets an icon for the CTA. You can pass SVG strings, or an icon type for Astro components.
translations Sets the text of the hardcoded labels. Please see the translations section above for more details.
className Pass additional CSS classes for the component.