Skip to main content
Version: 3.x

Accessing current shop configuration

From the Client (Public)

The current shop configuration can be accessed from the client using the public configuration.

note

The public shop configuration (config.public.shop) is a subset of the private shop configuration (config.shop).

This will only contain information that can be exposed to the client.

To learn more see usePublicConfig documentation.

import { usePublicConfig } from "@front-commerce/core/react";

const MyComponent = () => {
const { shop } = usePublicConfig();

return (
<div>
<h1>{shop.id}</h1>
<p>{shop.locale}</p>
</div>
);
};

From the Server (Private)

The current shop configuration can be accessed from the client using the app configuration.

note

The private shop configuration (config.shop) is a superset of the public shop configuration (config.public.shop).

This can contain additional information that should not be exposed to the client.

import type { LoaderFunctionArgs } from "@remix-run/node";

export const loader = async ({ context }: LoaderFunctionArgs) => {
const app = new FrontCommerceApp(context.frontCommerce);
const currentShopConfig = app.config.shop;
// ...
};