> For the complete documentation index, see [llms.txt](https://docs.b2b-sellers.com/b2b-platform/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.b2b-sellers.com/b2b-platform/3/developer-guides/b2bsellers-core-plugin/b2bplatformcontext.md).

# B2bPlatformContext

## **What is the B2bPlatformContext?**

In the Shopware standard there is already the normal SalesChannelContext, we have extended this via the "extension" accordingly with a new b2BPlatformContext to provide B2B-specific data in the user context.

#### Examples:

* Which employee of a "customer" is logged in?
* Is a sales employee logged in? And is he currently logged in to a customer.
* Is the employee an admin or not?
* Which employee with which role is logged in?

The b2bPlatformContext is available from anywhere. (Can be accessed from anywhere.)

#### **Example:**

![Figure 1. This B2BPlatform Context shows that the user is an employee of a client (isEmployee: true).](/files/bcbRv7gQUJEOw2toCl9K)

<div align="left"><img src="/files/i204t6WcNZmloTGlDtCE" alt="Figure 2 - This B2bPlatformContext shows a loggedin sales representative who has not yet logged in to a customer employee."></div>

#### **Note alert**

the B2BplatformContext is only set when you are logged in as, so we always recommend asking beforehand.

```
if(!$context->hasExtension('b2bPlatformContext')) {
return; 
}
```

Alternatively, the B2BPlatformContext can always be requested via the B2bContextTrait (see documentation [B2bContextTrait](/b2b-platform/3/developer-guides/b2bsellers-core-plugin/b2bcontexttrait.md)).

![](/files/CQ4QryzGnMKcnFEMqd1c)

#### Note Alert:

In the employeeCustomer is the connection table between the logged-in employee and the assigned customer. The role, admin, etc. are maintained here.

#### Examples:

<div align="left"><img src="/files/hWGa8RpLfPIzAVQA52js" alt="Figure 3. Here will be checked whether the logged-in user is a sales employee."></div>

![Figure 4: Here, the logged-in employee will be queried via the B2bPlatformContext. Notice. These are the general employee data, not the employees ->mapping -> Customer data.](/files/p898TBK8DLsgFpnvwnDC)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.b2b-sellers.com/b2b-platform/3/developer-guides/b2bsellers-core-plugin/b2bplatformcontext.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
