# Configure Storefront

The Storefront is accessible under the `<yourdomain>/product-catalog`.

## Catalog configuration

With the `ibexa/storefront` package, you can configure the product catalog and make it available to your shop users.

Before you start configuring the Storefront, make sure you have created, configured, and published [catalogs](https://doc.ibexa.co/projects/userguide/en/5.0/pim/work_with_catalogs/#create-catalogs) in the back office.

The configuration is available under the `ibexa.system.<scope>.storefront.catalog` [configuration key](https://doc.ibexa.co/en/latest/administration/configuration/configuration/#configuration-files). It accepts the following values:

1. All products available for all users:

```
ibexa:
    system:
        site:
            storefront:
                catalog: ~
```

If `null`is provided as the value, the Storefront makes the main product catalog (with all products) visible for all users.

2. To expose a single catalog with an identifier to all users, provide a string value of the catalog identifier:

```
ibexa:
    system:
        site:
            storefront:
                catalog: custom_catalog
```

3. Specific catalog for the defined customer group

You can expose different catalogs based on a customer group assigned to the current user.

To do it, provide the following configuration:

```
ibexa:
    system:
        site:
            storefront:
                catalog:
                    default: standard
                    customer_group:
                        retailer: retailer_catalog
                        wholesale: wholesaler_catalog
```

The basic configuration of the Storefront can look as follows:

```
ibexa:
    system:
        site_group:
            translation_siteaccesses:
                - site
                - site_pl
                - site_fr
                - site_de
            page_layout: '@ibexadesign/storefront/layout.html.twig'
            product_catalog:
                currencies:
                    - EUR
                    - PLN
                    - USD
                regions:
                    - poland
                    - france
                    - germany
                    - norway
            storefront:
                name: Ibexa
                logo: 'bundles/ibexaadminui/img/ibexa-logo.svg'
                catalog:
                    default: main
                    customer_group:
                        vip: vip
                product_list_limit: 9
                product_list_filters:
                    - product_type
                    - product_availability
                    - product_price
                product_render_action: 'Ibexa\Bundle\Storefront\Controller\ProductRenderController::renderAction'
                user_settings_groups:
                    - location
```

## Retrieve catalog assigned to user

The `\Ibexa\Contracts\Storefront\Repository\CatalogResolverInterface` interface allows retrieving the product catalog available for a specific user.

```
namespace Ibexa\Contracts\Storefront\Repository;

use Ibexa\Contracts\Core\Repository\Values\User\User;
use Ibexa\Contracts\ProductCatalog\Values\CatalogInterface;

interface CatalogResolverInterface
{
    public function resolveCatalog(?User $user = null): ?CatalogInterface;
}
```

`null` stands for the current user.

### Configure user account

The following user settings mechanisms used in `ibexa/storefront` are reused from `ibexa/user` package:

- [change password feature](https://doc.ibexa.co/en/latest/users/passwords/index.md)
- user avatar

Settings for a Storefront user are configured under the `ibexa.system.<scope>.storefront.user_settings_groups` [configuration key](https://doc.ibexa.co/en/latest/administration/configuration/configuration/#configuration-files):

```
ibexa:
    system:
        site_group:
            user_settings_groups:
                - location
                - custom_group
```

By default, only the `location` user settings is provided:

- Currency (from `ibexa/storefront`)
- Time zone
- Short date and time format
- Long date and time format
- Language
