Search code examples
spartacus-storefront

How can I make spartacus to use a different field configuration?


I would like to change the endpoint to use fields=FULL instead of the preconfigured fields.

In particular I want to change this endpoint of the storefinder:

https://spartacus-demo.eastus.cloudapp.azure.com:8443/occ/v2/electronics-spa/stores


Solution

  • Miroslaws comment pointed me to the official documentation and helped me to change my stores endpoint. You can do this for all endpoints.

    @NgModule({
      imports: [
        B2sStorefrontModule.withConfig({
          backend: {
            occ: {
              endpoints: {
                stores: 'stores?fields=stores(FULL),pagination(DEFAULT),sorts(DEFAULT)'
              }
            }
          }
        })
      ]
    })