-
Notifications
You must be signed in to change notification settings - Fork 250
In Store Pickup API Tutorials
- Configure In-Store Pickup delivery
- Create a Pickup Location
- Search Pickup Locations
- Search Pickup Locations using GraphQL
- Place order using In-Store Pickup delivery method
- Place order using In-Store Pickup delivery method with GraphQL
Go to Stores > Configuration > Sales > Delivery Methods
and enable In-Store Delivery.
Delivery type | Configuration name | Enabled by default? |
---|---|---|
In-Store Delivery | in_store | No |
Next, configure Distance Priority algorithm provider - it is used for filtering pickup locations by distance radius.
The name
, source_code
, country_id
, and postcode
attributes are required for a Source creation.
city
, street
and phone
are required for Pickup Location additionally.
Endpoint
POST http://<host>/rest/all/V1/inventory/sources
Headers
Content-Type application/json
Authorization: Bearer <admin_token>
Payload
{
"source": {
"description": " Source #17",
"source_code": "txspeqs",
"phone": "(555) 555-5555",
"email": "[email protected]",
"postcode": "77010",
"longitude": -95.383056,
"enabled": true,
"contact_name": "Ethan Carter",
"latitude": 29.762778,
"region_id": 57,
"region": "Texas",
"name": "Texas Sport Equipment Source #017",
"country_id": "US",
"city": "Houston",
"street": "4631 Airport Blvd #125",
"extension_attributes": {
"is_pickup_location_active": true,
"frontend_name": "Sport Equipment Store",
"frontend_description": "Sport Equipment Store description"
}
}
}
Response
Magento returns an empty array.
[]
inventoryInStorePickupApiGetPickupLocationsV1
API is responsible for searching Pickup Locations.
It has a wide variety of request parameters making it quite flexible:
-
area
(optional): for searching locations by area defined by a distance radius from the customer address-
radius
(required): search radius in KM, integer value. -
searchTerm
(required): search term string
-
-
filters
(optional) - a set of Pickup Location fields filters. Similar to regular Magento repository'sfilterGroups
field. There are filters by:-
country
(optional) -
postcode
(optional) -
region
(optional) -
city
(optional) -
street
(optional) -
name
(optional) -
pickupLocationCode
(optional)
-
-
pageSize
(optional) - analog of Magento repository'spageSize
-
currentPage
(optional) - analog of Magento repository'scurrentPage
-
scopeType
(optional) - Sales Channel Type. Default value iswebsite
-
scopeCode
(required) - Sales Channel code. The only one required parameter. -
sort
(optional) - analog of Magento repository'ssort
-
extensionAttributes
(optional)-
productsInfo
- list of products which that be assigned to each pickup location. Locations without all the products assigned will be filtered out.- [0] - single product info node
-
sku
(required) - product SKU -
extensionAttributes
- extension point for future customizations
-
- [0] - single product info node
-
Endpoint
GET http://<host>/rest/all/V1/inventory/in-store-pickup/pickup-locations/
Payload
searchRequest[area][radius]: 1500
searchRequest[area][searchTerm]: Austin
searchRequest[scopeCode]: base
searchRequest[extensionAttributes][productsInfo][0][sku]: SKU1
Response Magento returns Pickup Locations list, search request given and total results count.
{
"items": [
{
"pickup_location_code": "txspeqs",
"name": "Sport Equipment Store",
"email": "[email protected]",
"contact_name": "Ethan Carter",
"description": "Sport Equipment Store description",
"latitude": 29.7543,
"longitude": -95.3609,
"country_id": "US",
"region_id": 57,
"region": "Texas",
"city": "Houston",
"street": "4631 Airport Blvd #125",
"postcode": "77010",
"phone": "(555) 555-5555"
}
],
"search_request": {
"area": {
"radius": 1500,
"search_term": "Austin"
},
"current_page": 1,
"scope_type": "website",
"scope_code": "base",
"extension_attributes": {
"products_info": [
{
"sku": "SKU1"
}
]
}
},
"total_count": 1
}
TODO
First of all, Configure In-Store Pickup delivery, Create a Pickup Location and proceed with steps 1-8 (except setting delivery method) described in the Order Processing with Inventory Management tutorial.
Find a pickup location suitable for placing the order with.
For example, let it be 'Sport Equipment Store' with code txspeqs
.
Set In-Store Pickup Delivery method, and the pickup location code.
Endpoint
POST <host>/rest/us/V1/carts/mine/shipping-information
(see step 8)
Payload
{
"addressInformation": {
"shipping_address": {
"countryId": "US",
"regionId": 57,
"regionCode": "TX",
"region": "Texas",
"street": [
"4631 Airport Blvd #125"
],
"telephone": "(555) 555-5555",
"postcode": "77010",
"city": "Houston",
"firstname": "Sport Equipment Store",
"lastname": "Store",
"saveInAddressBook": 0,
"extension_attributes": {
"pickup_location_code": "txspeqs"
}
},
"billing_address": {
"region": "New York",
"region_id": 43,
"region_code": "NY",
"country_id": "US",
"street": [
"123 Oak Ave"
],
"postcode": "10577",
"city": "Purchase",
"firstname": "Jane",
"lastname": "Doe",
"email": "[email protected]",
"telephone": "512-555-1111"
},
"shipping_method_code": "pickup",
"shipping_carrier_code": "in_store",
"extension_attributes": {}
}
}
The rest of the steps are the same as for regular order placing & processing.
TODO
Send an email to the customer that order is ready to be picked up, and create a shipment.
Endpoint
POST http://<host>/rest/all/V1/order/notify-orders-are-ready-for-pickup
Headers
Content-Type application/json
Authorization: Bearer <admin_token>
Payload
{
"orderIds": [
81
]
}
Response
Magento returns an array with success status and array of error messages for each failed order.
{
"successful": true,
"failed": []
}
Multi-Source Inventory developed by Magento 2 Community
- Technical Vision. Catalog Inventory
- Installation Guide
- List of Inventory APIs and their legacy analogs
- MSI Roadmap
- Known Issues in Order Lifecycle
- MSI User Guide
- 2.3 LIVE User Guide
- MSI Release Notes and Installation
- Overview
- Get Started with MSI
- MSI features and processes
- Global and Product Settings
- Configure Source Selection Algorithm
- Create Sources
- Create Stock
- Assign Inventory and Product Notifications
- Configure MSI backorders
- MSI Import and Export Product Data
- Mass Action Tool
- Shipment and Order Management
- CLI reference
- Reports and MSI
- MSI FAQs
- DevDocs Documentation
- Manage Inventory Management Modules (install/upgrade info)
- Inventory Management
- Reservations
- Inventory CLI reference
- Inventory API reference
- Inventory In-Store Pickup API reference
- Order Processing with Inventory Management
- Managing sources
- Managing stocks
- Link and unlink stocks and sources
- Manage source items
- Perform bulk actions
- Manage Low-Quantity Notifications
- Check salable quantities
- Manage source selection algorithms
- User Stories
- Support of Store Pickup for MSI
- Product list assignment per Source
- Source assignment per Product
- Stocks to Sales Channel Mapping
- Adapt Product Import/Export to support multi Sourcing
- Introduce SourceCode attribute for Source and SourceItem entities
- Assign Source Selector for Processing of Returns Credit Memo
- User Scenarios:
- Technical Designs:
- Module Structure in MSI
- When should an interface go into the Model directory and when should it go in the Api directory?
- Source and Stock Item configuration Design and DB structure
- Stock and Source Configuration design
- Open Technical Questions
- Inconsistent saving of Stock Data
- Source API
- Source WebAPI
- Sources to Sales Channels mapping
- Service Contracts MSI
- Salable Quantity Calculation and Mechanism of Reservations
- StockItem indexation
- Web API and How To cover them with Functional Testing
- Source Selection Algorithms
- Validation of Domain Entities
- PHP 7 Syntax usage for Magento contribution
- The first step towards pre generated IDs. And how this will improve your Integration tests
- The Concept of Default Source and Domain Driven Design
- Extension Point of Product Import/Export
- Source Selection Algorithm
- SourceItem Entity Extension
- Design Document for changing SerializerInterface
- Stock Management for Order Cancelation
- Admin UI
- MFTF Extension Tests
- Weekly MSI Demos
- Tutorials