> 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).](https://content.gitbook.com/content/xtXbbs1TkvdlT98tybg5/blobs/MAagpO1hfFQfgWuf8rx2/example%20-%20B2BPlatformContext.png)

<div align="left"><img src="https://content.gitbook.com/content/xtXbbs1TkvdlT98tybg5/blobs/MUWer1imZvsud5PZYLDW/example%20-%20B2BPlatformContext%202.png" 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)).

![](https://content.gitbook.com/content/xtXbbs1TkvdlT98tybg5/blobs/8qxjGnm6FrzjmDsZeg0V/example%20-%20B2BPlatformContext%203.png)

#### 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="https://content.gitbook.com/content/xtXbbs1TkvdlT98tybg5/blobs/StUcPnG1gWACZuMQKQ7n/example%20-%20B2BPlatformContext%204.png" 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.](https://content.gitbook.com/content/xtXbbs1TkvdlT98tybg5/blobs/K4cy8BSXwuD9A0P10yRC/example%20-%20B2BPlatformContext%205.png)


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
