Lab - Set Up a Custom Buyer Portal
Lab - Set Up a Custom Buyer Portal
Lab - Set Up a Custom Buyer Portal
This lab will walk you through setting up a local environment running a custom Buyer Portal, as well as connecting this project to your Stencil storefront.
Instead of cloning the main Buyer Portal repository, you’ll be setting up a custom repo with boilerplate necessary for subsequent exercises.
See the Buyer Portal overview in the documentation for details.
Rather than start your custom code from scratch, you’ll be starting from a Buyer Portal codebase that already has certain boilerplate in place, in preparation for subsequent labs.
degit, if you didn’t install it in the earlier setup lab.From here on, we’ll leave managing your project’s source control to you.
Remember, in these exercises, we’re working with a custom starter project with some important boilerplate.
When setting up a new Buyer Portal project of your own, you’ll want to fork the main repository or clone it directly to start your project:
Troubleshooting
The yarn command is unrecognized.
In some environments where file permissions are highly restricted, you may need to prepend corepack to the use of yarn commands (for example, corepack yarn install)
.env-example file..env, update the value of VITE_B2B_URL and add VITE_LOCAL_DEBUG:Just as with the mini app, take note of the localhost port displayed in your terminal output. (e.g., http://localhost:3001)
Make sure not to delete these scripts in a store intended for production!
See the link above for the latest version of the header and footer scripts.
The header script should look something like the following:
The footer script should look something like:
If your dev server is running on a port other than 3001, make sure to update any URLs in the header/footer scripts accordingly.

Note that you will find Buyer Portal settings directly under Settings in the B2B Edition nav in a single storefront implementation, or in the settings of a specific channel under Storefronts if your store supports multi-storefront.
See the setup guide in the BigCommerce docs for full details of the storefront update.

In Catalyst
As previously mentioned, the process for injecting the Buyer Portal is different in Catalyst. This method involves scripts managed directly in the Catalyst codebase, not via Script Manager.
See the Catalyst guide for full details on swapping in your custom Buyer Portal.
In this step and all subsequent exercises, file paths are relative to apps/storefront/src in your Buyer Portal project.
pages/order/Order.tsx.Box component in the JSX returned from Order, add a “Hello World” block.
You’ve successfully connected your Stencil storefront to your local Buyer Portal project!
Feel free to remove your “Hello World” block before proceeding.