4.7. Admin Development Constraints

This chapter lists some development constraints of admin widgets and UI routes.

Arrow Functions#

Widget and UI route components must be created as arrow functions. Otherwise, Medusa doesn't register them correctly.

Code
1// Don't2function ProductWidget() {3  // ...4}5
6// Do7const ProductWidget = () => {8  // ...9}

Widget Zone#

A widget zone's value must be wrapped in double or single quotes. It can't be a template literal or a variable. Otherwise, Medusa doesn't register the widget correctly.

Code
1// Don't2export const config = defineWidgetConfig({3  zone: `product.details.before`,4})5
6// Don't7const ZONE = "product.details.after"8export const config = defineWidgetConfig({9  zone: ZONE,10})11
12// Do13export const config = defineWidgetConfig({14  zone: "product.details.before",15})
Was this chapter helpful?
Ask Anything
Ask any questions about Medusa. Get help with your development.
You can also use the Medusa MCP server in Cursor, VSCode, etc...
FAQ
What is Medusa?
How can I create a module?
How can I create a data model?
How do I create a workflow?
How can I extend a data model in the Product Module?
Recipes
How do I build a marketplace with Medusa?
How do I build digital products with Medusa?
How do I build subscription-based purchases with Medusa?
What other recipes are available in the Medusa documentation?
Chat is cleared on refresh
Line break