Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
added more tests

updated types to 2024-04

simplified example

doc update
  • Loading branch information
dustinfirman committed Apr 8, 2024
1 parent 714fe1e commit d1a15c1
Show file tree
Hide file tree
Showing 15 changed files with 275 additions and 2,195 deletions.
12 changes: 7 additions & 5 deletions examples/b2b/README.md
Expand Up @@ -9,14 +9,16 @@ This is an example implementation of a B2B storefront using Hydrogen. It include
1. Retrieving company location data from a logged in customer using the [Customer Account API](https://shopify.dev/docs/api/customer/2024-04/queries/customer)
2. Displaying a list of company locations and setting a `companyLocationId` in session
3. Using a storefront `customerAccessToken` and `companyLocationId` to update cart and get B2B specific rules and pricing
4. Using a storefront `customerAccessToken` and `companyLocationId` to [contextualize queries](https://shopify.dev/docs/api/storefront#directives) and get B2B pricing, volume pricing, and quantity rules
4. Using a storefront `customerAccessToken` and `companyLocationId` to [contextualize queries](https://shopify.dev/docs/api/storefront#directives) using the `buyer` argument

Only queries on the product display page, `app/routes/products.$handle.tsx`, were contextualized in this example. For a production storefront, all queries for product data should be contextualized.

## Install

Setup a new project with this example:

```bash
npm create @shopify/hydrogen@latest -- --template custom-cart-method
npm create @shopify/hydrogen@latest -- --template b2b
```

## Requirements
Expand All @@ -28,9 +30,9 @@ npm create @shopify/hydrogen@latest -- --template custom-cart-method
## Key files

This folder contains the minimal set of files needed to showcase the implementation.
More files were changed, but these are the ones requried to implement a basic headless B2B storefront.
Files that aren’t included by default with Hydrogen and that you’ll need to
create are labeled with 🆕.
Not all queries where contextualized for B2B. `app/routes/products.$handle.tsx` provides
reference on how to contextualize storefront queries.Files that aren’t included by default
with Hydrogen and that you’ll need to create are labeled with 🆕.

| File | Description |
| ---------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
Expand Down
149 changes: 0 additions & 149 deletions examples/b2b/app/routes/_index.tsx

This file was deleted.

0 comments on commit d1a15c1

Please sign in to comment.