Buy online, pick up in-store (BOPIS)
Buy online, pick up in-store (BOPIS)
"BOPIS" stands for "Buy Online, Pick Up In-Store." It’s a commerce strategy that allows customers to place orders for items online and then pick up those items at a physical store location. This approach combines the convenience of online shopping with the immediacy of in-store fulfillment. Using the method of your choice, your site will need to determine which store is the closest to the customer. You must then retrieve the identifier associated with this store that matches the value from your availability identifier field.
You can leverage this store identifier, for example store-123
, in your search interface to filter on products that are only available in this store.
Ensure you have properly configured your availability channels when setting up your catalog configuration.
The identifier must match the value set in the Availability ID field of the catalog configuration.
When configuring your availabilities in your catalog configuration, you selected the ec_availability_id
field as the Availability ID field, which uniquely identifies each availability channel in your index.
You then pushed availability items in which the ec_availability_id
field contains a unique identifier (that is, store-123
):
{
"ec_availability_id": "store-123",
"lat": 45.4975,
"long": -73.5687,
"ec_available_items": ["001-red-8_wide","001-red-9_wide","001-red-10_wide","001-red-11_wide", "001-blue-8_wide"],
"objecttype": "Availability"
}
With both your items and catalog configuration using the same ec_availability_id
, you can add the @ec_availability_id==store-123
query to filter for all products that are available in this store.
Availability constraints
An availability constraint refers to a specific limitation or condition that influences the availability and accessibility of products within a commerce system. It implies that certain criteria, such as price lists, groups, entitlements, or stores, are set as constraints, and these constraints may determine whether certain products are accessible or visible in specific channels.
In a business-to-business (B2B) scenario, availability constraints might be defined by factors like price lists, groups, or entitlements. For instance, certain customers or groups of customers may have access to specific price lists or product groups based on their business relationship with the company.
In a business-to-consumer (B2C) scenario, the availability constraint could be a store. This suggests that certain products may only be available for purchase or pickup in specific physical stores, tying into the concept of BOPIS.
The following code showcases how to add a filter in the query to only retrieve products that are available in your channel, in the context of the Coveo Atomic library search interface.
For this filter to work properly, your search interface must use a catalog entity configured with multiple availabilities. |
<head>
<!-- ... -->
<script type="module">
import {loadAdvancedSearchQueryActions} from 'https://static.cloud.coveo.com/atomic/v2/headless/headless.esm.js';
function setAvailabilityFilter(engine) {
const action = loadAdvancedSearchQueryActions(engine).updateAdvancedSearchQueries({
aq: '@ec_availability_id=<AVAILABILITY_ID>',
});
engine.dispatch(action);
}
(async () => {
await customElements.whenDefined('atomic-search-interface');
const searchInterface = document.querySelector('atomic-search-interface');
await searchInterface.initialize({
accessToken:'<ACCESS_TOKEN>',
organizationId: '<ORGANIZATION_ID>'
});
const engine = searchInterface.engine;
setAvailabilityFilter(engine);
searchInterface.executeFirstSearch();
})();
</script>
<!-- ... -->
</head>
Import the target loadAdvancedSearchQueryActions Headless action loader via the CDN. |
|
Create a function that takes as input an engine instance and uses the imported action loader to dispatch an action to update the query expression sent to Coveo. | |
Retrieve an action using the updateAdvancedSearchQueries action loader.
Utilize the aq property to specify a query filter by choosing the unique availability ID of the channel for which you wish to fetch products. |
|
Replace <AVAILABILITY_ID> with the unique identifier (ec_availability_id ) of the channel for which you want to fetch products. |
|
<ACCESS_TOKEN> (string) is an API key or search token that grants the Allowed access level on the Execute Queries domain, as well as the Push access level on the Analytics Data domain in the target organization. |
|
<ORGANIZATION_ID> (string) is the unique identifier of your Coveo organization (for example, mycoveoorganizationa1b23c ). |
|
Access and store the engine in a variable. | |
Call the setAvailabilityFilter method to dispatch the action. |
For more information on dispatching actions, see the Headless documentation.