Installing a Custom Order Confirmation Page
You can engage with your customers after purchase with a custom order confirmation page even if you are not using a custom checkout. This article outlines how to package a custom order confirmation file, and install a custom confirmation file via the control panel. The installation process is the same as Installing a Custom Checkout, except you will modify a different file (opens in a new tab) in Open Source Checkout (opens in a new tab).
Generate the JavaScript loader file
Generating a loader file is the first step in installing a custom order confirmation page. If you are creating a custom checkout and a custom order confirmation page using checkout-js, the generated loader file is the same for both. However, you can install a custom order confirmation page and still use the default checkout.
The loader file must be responsible for the following:
- Loading all the required assets, including CSS files
- Running the app
Packaging custom order confirmation page with Open Source Checkout
If using Open Source Checkout, you can generate the loader file by following these steps:
- Navigate and locate the Open Source Checkout folder using the terminal, and run
npm ci
to download dependencies. - Run
npm run build
to generate a/dist/
folder with all the files.
You can deploy and install the custom confirmation page when using Open Source Checkout to view changes and test implementations through the UI.
Properties available on the custom order confirmation page
When a store uses a custom confirmation page, the following properties are attached to the window.checkoutConfig
object on the checkout page:
containerId
: ID of the HTML component where you load the checkout app.orderId
: The generated order ID.publicPath
: If present, the public URL of the custom checkout file's directory.
To use the data exposed in the window object, include relevant code in your loader file. The following is an example of the relevant code:
ReactDOM.render(
<OrderConfirmation orderId={ window.checkoutConfig.orderId } />,
document.getElementById(window.checkoutConfig.containerId)
);
Hosting a custom order confirmation page
You will need to host the custom confirmation file online so it can be served by the store using an external hosting service. Using an external host will allow you the freedom to automate the build process if you wish and push updates automatically from your local machine.
Using WebDAV to host a custom order confirmation page
You can upload a custom order confirmation page to your store's server using WebDAV. The instructions to upload the /dist
folder to the BigCommerce server using WebDav are below:
- Before proceeding, ensure you have downloaded Cyberduck (opens in a new tab), our recommended WebDAV client.
- From your store control panel, navigate to Server Settings > File Access (WebDAV).
- To automatically connect with Cyberduck, see Single-click Login (opens in a new tab).
- To manually connect with Cyberduck, see Connecting with Cyberduck Manually (opens in a new tab).
- From Cyberduck, enter the
/content
folder and create a new folder named OrderConfirmation. - Navigate into the
/dist
folder in your OrderConfirmation project. - Copy the contents of the
/dist
folder and paste it into the OrderConfirmation folder.
For more information on how to use Cyberduck, refer to the File Access (WebDAV) (opens in a new tab) page.
Installing a custom order confirmation page
You can install a custom checkout on a store in the following two ways:
Install using the control panel
To install a custom order confirmation page on a store, follow these steps:
-
Navigate to Advanced Settings > Checkout in your store's control panel.
-
Under Custom Order Confirmation, type the following in the Script URL field, replacing
version
with the latest version number generated by running thenpm run release:alpha
command:
webdav:checkout/auto-loader-<version>.js
- Prepending
webdav:
Indicates that the URL is in the remote WebDAV directory. It will treat/content
as the root WebDAV directory. - It is important to include
<version>
number in the Script URL field. Because if you make changes to the same provided loader filename, you could serve a cached version to the user. - If you previously created a custom checkout, use the same Script URL. You may need to enter the Script URL again.
- Click the Save button at the bottom of the page.
- Navigate to your live storefront to view your new custom order confirmation page.
Install using the V3 Checkout API
To install a custom checkout on a store, use the Update Checkout Settings endpoint to install the loader file.
Implementing localization
You can customize your checkout page and customer order confirmation page to display in any one language of your choice. To localize your checkout, download and extract your Stencil theme. Navigate to the /lang
subfolder, which includes the en.json
(opens in a new tab) English language file. Create a new translation file (i.e., es.json
) and copy the content of the translation file across from checkout.js (opens in a new tab) into Cornerstone. Use {{lang checkout.my-string}}
or {{lang order-confirmation.my-string}}
and enter the key-value pairs. The example below shows English and Spanish strings.
In en.json
, add checkout
key and corresponding information for the value.
"checkout": {
"title": "Checkout"
}
In es.json
, add the same checkout
key and the Spanish translation of the value.
"checkout": {
"title": "Pago"
}
For more details on how to add translation keys to a language file, see the Localization Tutorial (opens in a new tab).
Related resources
Articles
- Checkout SDK
- File Access (WebDav) (opens in a new tab)
- Installing Custom Checkouts in the Control Panel (opens in a new tab)