How to Add Custom Fields to Customer Invoices?
This guide will help you add custom fields, such as a company registration number or tax number, to your customer invoices in SureCart. Follow these steps to capture the data at checkout and display it on future invoices.
How Can You Add Custom Fields at Checkout?
To add custom fields, follow these steps:
- Edit the Checkout Form:
- Go to your checkout form in SureCart and add a Conditional block.
- Insert a TextField or other suitable fields for the additional information you need to capture from customers.
- These will be displayed during checkout for customers to fill in.
2. Store Data as Metadata:
- The custom fields will be stored as metadata on the checkout object. For example:
metadata: {
"invoice_column_1": "Customer-provided value",
"invoice_column_2": "Another customer-provided value"
}
How Can You Display Custom Fields on Invoices?
- Access the Invoice Template:
- Navigate to the invoice template editor at SureCart Invoice Template.
- Use Metadata in the Template:
- To display the metadata, include the following code where you’d like the custom fields to appear:
<p>{{ checkout.metadata.invoice_column_1 }}</p>
<p>{{ checkout.metadata.invoice_column_2 }}</p>
3. This will display the values entered by the customer at checkout on their invoice.
What About Existing Subscriptions?
For customers who already have active subscriptions and did not fill in these custom fields, here are your options:
- Manual Update: You can manually update the customer information using SureCart’s API. Head to SureCart API Reference to update the metadata for existing customers.
- Customer Dashboard: You could also allow customers to update their information directly through their dashboard. This feature may require custom development, as there’s no UI for metadata updates at this time.
How Can You Manually Add Data via API?
If you need to update customer metadata manually, follow these steps:
- Get Authorization: Include your secret token in the Authorization field.
- Provide Checkout ID: Add the appropriate checkout ID for the customer.
- Add Metadata: In the request body, include the metadata fields that need updating.
- Submit: Hit “Try it” in the API console to save your changes.
For more details, check the SureCart API documentation here.
We hope this guide helps you add custom fields to your invoices and manage customer data seamlessly. If you run into any issues, feel free to leave a comment below, and we’ll be happy to assist you further!
We don't respond to the article feedback, we use it to improve our support content.