magento / magento/inventory

Extensibility of GraphQl Pickup Locations

Open
#3,235 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Progress: ready for grooming
Dominant language
PHP
Stars
357
Forks
262
PR merge metrics
No merged PRs in 30d

Description

### Description (*)

From a frontend UI perspective it would be great if third party carrier pickup locations are available through the pickupLocations query endpoint and use the same mutations to select the shipping address.

### Expected behavior (*)

The `PickupLocations.items` type should be of value `[PickupLocationInterface]`

https://github.com/magento/inventory/blob/1.2-develop/InventoryInStorePickupGraphQl/etc/schema.graphqls#L12
```graphql
interface PickupLocationInterface {
pickup_location_code: String
}
type PickupLocation implements PickupLocation {
...
}
```

It might be better to move the PickupLocations graphql schema to its own separate module, since it will not strictly be an 'in store' pickup location?

### Benefits
I think this improves Magento's extensibility and offering a UI for carries to add their pickup locations gives more control to the developer.

### Additional information

I was thinking, shoudn't almost _all_ return types be interfaces, so extension developers can more easily extend endpoints in general?

### Alternatives

It isn't directly clear if this document applies: https://github.com/magento/architecture/blob/master/design-documents/graph-ql/best-practice/extensibility.md

It might be possible for PickupLocation implementers to add an additional field to a PickupLocation, but would be better if we're not jamming everything in a single type:

```graphql
type PostNlOpeningHour {
date: String!
from: String
to: String
}

type PickupLocation {
post_opening_hours: [PostNlOpeningHour]
}
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with InventoryInStorePickupGraphQl/etc/schema.graphqls, especially the PickupLocations.items type and PickupLocationInterface definition. Read the referenced GraphQL extensibility best-practice document and inspect the pickupLocations query and shipping-address mutations. Done means third-party pickup locations can use the query and existing mutations without being forced into one concrete type.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, php
Domain
api, backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.