What is it?

The delivery message is shown on the buy button on the product detail view, within the configuration popover on the product detail view and on a line item in the case. It can be used to provide the user with an extra message unique to the selected product variant. For example an estimated delivery date, or an only x left in stock message.


The images below show how the delivery message will appear on the buy button of the product detail view, the configuration popover of the product detail view and the line item in the cart.


How to do it?

In order for the delivery message to be displayed it needs to be present as an attribute on the product stock object.


To fetch the product availability Highstreet will make the following graphql query


For example:


curl --data-binary '{"query":"query($filter: ProductFilterInput!) {\n  products(filter: $filter) {\n    items {\n      type_id\n      sku\nstock_status\nonly_x_left_in_stock\nspecial_price\nspecial_to_date\nspecial_from_date\nprice {\n  regularPrice {\n    amount {\n      value\n    }\n  }\n}\n\n\n      ... on ConfigurableProduct {\n        variants {\n          product {\n            sku\nstock_status\nonly_x_left_in_stock\nspecial_price\nspecial_to_date\nspecial_from_date\nprice {\n  regularPrice {\n    amount {\n      value\n    }\n  }\n}\n\n\n          }\n        }\n      }\n    }\n  }\n}\n","variables":{"filter":{"sku":{"in":["407550"]}}}}' 'https://yourdomain.com/graphql'

Response:

{
	"data": {
		"products": {
			"items": [{
				"type_id": "simple",
				"sku": "407550",
				"stock_status": "IN_STOCK",
				"only_x_left_in_stock": null,
				"special_price": null,
				"special_to_date": null,
				"special_from_date": null,
                                 **"delivery_message": "Only 1 left in stock",**
				"price": {
					"regularPrice": {
						"amount": {
							"value": 1599
						}
					}
				}
			}]
		}
	}
}



Things to Note

The app expects the delivery message to be localised.

If a delivery message should not be displayed for a particular variant then the delivery message attribute should not be returned in the response or it's value should be null.