Lab - Enable Makeswift for Product FAQs
Lab - Enable Makeswift for Product FAQs
Lab - Enable Makeswift for Product FAQs
This exercise continues where you left off previously in your Makeswift project. Start the dev server from the project root if it’s not currently running:
If you need a fresh start, you can follow the instructions below to set up a new project complete with previous exercise code.
If it’s helpful to compare your own code as you go, you can clone or download the completed version of this lab as a reference.
Product FAQs Component Lab Snapshot
Your starter codebase already includes a custom feature that displays frequently asked questions on the product detail page.

This existing component implementation fetches product metafield data to provide the FAQs that are rendered.
This feature in its starting state is the result of custom labs from the Catalyst Core course. For instructions on preparing your product data with the appropriate metafields, see that course.
In this exercise, you’ll enhance the existing capabilities by providing Makeswift properties allowing users to create FAQs directly in the editor, replacing or adding to the metafield-based FAQs.
Your first step is to modify the way the basic ProductFaqs client component is rendered in the page, “wrapping” it in a component that will ultimately provide Makeswift-controlled props.
ContextProps is based on the props expected by the ProductFaqs component. Here you are establishing default values for two of those props (_limit_and faqs), while the rest can also be supplied with the context provider.
Note the use of the <Stream> component wrapping <ProductFaqs>. This pattern is covered in more detail in the labs focused on building the initial Product FAQs UI. <Stream> allows rendering a fallback until the “streamable” value is eventually resolved. The same pattern is used within ProductFaqs itself.
Here, we’re waiting for the FAQs collection to be available before rendering ProductFaqs because we will eventually need to manipulate the list before passing it on. This won’t require changing anything in the original component, because the streamable pattern is flexible enough to handle values that are still resolving or have already resolved.
With the actual Makeswift component now registered, our next step is to build the final wrapper component that will accept the same props as ProductFaqs, set those in the context provider, and render MakeswiftProductFaqs as a built-in element.
MakeswiftComponent.Notice that the ID supplied to getComponentSnapshot is unique to the product ID that was passed in the component’s props, meaning that Makeswift content and configuration for this component will be on a per-product basis.
This component is now ready to be swapped into the context where ProductFaqs was previously rendered directly.
ProductFaqs import with the Makeswift version.
Your component doesn’t yet define any editable properties, but you’ve successfully registered it with Makeswift while preserving its original functionality.
You’ll now add a Makeswift control for creating additional FAQs directly in the editor.
For now, the List control only supports simple text inputs for both question and answer.
So far, each FAQ added via Makeswift can contain only simple text for the “answer” portion. You can offer even more flexibility by providing the option to build an answer entirely with the editor canvas. You’ll add a new Slot control for this, along with a property to select which style of content a FAQ will use.
The final list of FAQs being passed in the faqsCollection prop can now include either a string or a ReactNode for each answer. We need to update the props schema in FaqsList accordingly.
Faq interface.
As a final enhancement, you’ll introduce a Makeswift control that will dictate whether FAQs based on metafields will be shown at all. This will allow editors to decide, on a product-by-product basis, whether manually created FAQs will replace or add to those sourced from the product data.
showLoadMore prop dependent on the same value.