Store Availability

Search and display store locations with real-time stock availability and opening hours.

For installation instructions, see Getting Started with Unify Widgets.

Basic Implementation

As a dialog (default)

<unify-store-availability-widget
  api-key="your-api-key"
  item-id="your-item-id"
></unify-store-availability-widget>

<button onclick="document.querySelector('unify-store-availability-widget').open = true">
  Where to buy
</button>

Inline (no dialog)

<unify-store-availability-widget
  api-key="your-api-key"
  item-id="your-item-id"
  no-dialog
></unify-store-availability-widget>

Component Attributes

AttributeTypeRequiredDescription
api-keyStringYesAPI key for Unify requests
item-idStringYesItem identifier for stock-store API calls
openBooleanNoControls dialog visibility when dialog mode is enabled
no-dialogBooleanNoRenders content inline instead of inside a dialog
demoBooleanNoEnables demo mode (X-Demo-Mode: true header)

Component Properties

PropertyTypeRequiredDescription
configObjectNoConfiguration object (see Config Options)

Config Options

Pass configuration via the config property to customize text labels, behavior, and thresholds.

document.querySelector('unify-store-availability-widget').config = {
  dialogTitle: 'Find in store',
  locale: 'en-US',
  maxRange: 20,
  // ... more options
};

Dialog & Layout

OptionDefaultDescription
dialogTitle"Store availability"Title of the search dialog
dialogDescription"Check the availability of your item in the store of your choice - if needed, contact the store."Description text below title

Search & Loading

OptionDefaultDescription
addressLabel"Address"Search input label
addressPlaceholder"Your address"Search input placeholder
submitButtonLabel"Submit"Search submit button text
submittingLabel"Submitting..."Search loading state text
geolocateButtonLabel"Use my location"Geolocation button label
geolocatingLabel"Locating..."Geolocation loading state
loadingMessage"Searching for stores..."Text shown while stores are loading
validationErrorMessage"Please enter a full address including your city name"Address validation error message
searchErrorMessage"An error occurred while searching. Please try again."API error fallback
noStoresMessage"No stores found for the provided information."Empty result message

Search Options

OptionDefaultDescription
requireFullAddressfalseRequire at least one letter in address before submit (prevents postal code-only searches)
availableStockfalseInitial state: only display available stock
availableStockLabel"Only display available stock"Toggle label
hideAvailableStockTogglerfalseHide the stock filter checkbox
maxRange10Maximum search distance in km

Store Display Options

OptionDefaultDescription
hideStoreAddressfalseHide store address in results
hideStoreContactfalseHide store phone number
hideOpeningHoursfalseHide open/closed status and hours
storeOpenLabel"Open"Label for open stores
storeClosedLabel"Closed"Label for closed stores
storeOpeningHoursLabel"Opening Hours"Section heading for hours
noOpeningHoursMessage"No opening hours available"Fallback when hours unavailable
exceptionalDaysLabel"Exceptional Days"Header for holiday hours
informationLabel"Information"Header for extra opening hours info

Stock Display

OptionDefaultDescription
displayStockQuantitytrueShow quantity in stock labels
stockLimitedThreshold10Quantity threshold between "limited" and "available"
stockAvailableLabelWithQuantity"Available (%qty% remaining)"Available stock label with %qty%
stockAvailableLabel"Available"Available stock label without quantity
stockLimitedLabelWithQuantity"Limited stock (%qty% remaining)"Limited stock label with %qty%
stockLimitedLabel"Limited stock"Limited stock label without quantity
stockUnavailableLabel"Out of stock"Out-of-stock label

Click & Go Options

OptionDefaultDescription
showClickAndGoInfofalseShow click-and-go availability badge
storeClickAndGoAvailableLabel"⏱️ Click and Go Available"Click-and-go available label
storeClickAndGoNotAvailableLabel"🚫 Click and Go Not Available"Click-and-go unavailable label
showStorePickupButtonfalseShow "Store Pickup" button for each store
storePickupButtonLabel"Store Pickup"Button text for store pickup action

Formatting

OptionDefaultDescription
locale"en-US"Locale for date and number formatting (e.g., "fr-FR", "de-DE")
weekdayFormat"long"Weekday display format: "long" (Monday), "short" (Mon), "narrow" (M)

Error Handling

OptionDefaultDescription
errorMessage"An error occurred while fetching store data. Please try again later."Generic error message

Styling

CSS Custom Properties (recommended)

All visual tokens (colors, sizes, spacing, fonts) are exposed as CSS custom properties prefixed with --unify-. This is the stable styling API.

Set them on the widget element or any ancestor:

unify-store-availability-widget {
  --unify-dialog-bg: #ffffff;
  --unify-dialog-color: #333333;
  --unify-store-status-open-color: #15803d;
  --unify-store-status-closed-color: #dc3545;
  --unify-geolocate-button-bg: #1a56db;
  --unify-geolocate-button-color: white;
}

To discover all available properties:

  1. Open browser DevTools
  2. Inspect the <unify-store-availability-widget> element
  3. Look at the Computed tab for all --unify-* entries
  4. Edit them live in the Styles panel to preview

CSS Parts

Structural elements can be targeted using ::part():

unify-store-availability-widget::part(dialog) {
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

unify-store-availability-widget::part(store-status--open) {
  font-weight: bold;
  color: #15803d;
}

⚠️ Parts may change between versions. Use CSS custom properties where possible.

To find available parts, inspect the widget's shadow DOM in DevTools — every element with a part attribute is targetable from outside.

Events

dialog-opened

Fired when the dialog open/close state changes.

document.querySelector('unify-store-availability-widget').addEventListener('dialog-opened', (event) => {
  console.log('Dialog is', event.detail.open ? 'open' : 'closed');
});

Detail shape:

{
  open: boolean  // true when opened, false when closed
}

store-pickup

Fired when user clicks the "Store Pickup" button (only dispatched if showStorePickupButton config option is true).

document.querySelector('unify-store-availability-widget').addEventListener('store-pickup', (event) => {
  console.log('Store selected:', event.detail.location.name);
  console.log('Item:', event.detail.itemId);
});

Detail shape:

{
  itemId: string,        // The item ID passed to the widget
  location: {            // Store object with full details
    location_id: string,
    name: string,
    address: string,
    distance: number,
    phone_number: string,
    stock: { quantity: number, status: string },
    opening_hours: { /* ... */ },
    click_and_go: boolean
  },
  source: 'location'     // Always 'location'
}

Examples

Basic setup

const widget = document.querySelector('unify-store-availability-widget');

widget.config = {
  dialogTitle: 'Find in store',
  storeOpenLabel: 'Open now',
  storeClosedLabel: 'Closed',
  maxRange: 25,
  locale: 'en-US',
};

// Open the search dialog
widget.open = true;

With Click & Go and Store Pickup

const widget = document.querySelector('unify-store-availability-widget');

widget.config = {
  dialogTitle: 'Availability near you',
  showClickAndGoInfo: true,
  showStorePickupButton: true,
  storePickupButtonLabel: 'Order for pickup',
  maxRange: 30,
};

// Handle store pickup action
widget.addEventListener('store-pickup', (event) => {
  const { location, itemId } = event.detail;
  console.log(`User selected ${location.name} for item ${itemId}`);
  // Send to your backend or order system
});

widget.open = true;

Styled with custom theme

<style>
  unify-store-availability-widget {
    /* Colors */
    --unify-dialog-bg: #f8f9fa;
    --unify-dialog-color: #212529;
    --unify-backdrop-bg: rgba(0, 0, 0, 0.6);
    
    /* Store status */
    --unify-store-status-open-color: #28a745;
    --unify-store-status-closed-color: #dc3545;
    
    /* Buttons */
    --unify-geolocate-button-bg: #007bff;
    --unify-geolocate-button-color: white;
    
    /* Spacing & sizing */
    --unify-input-border-radius: 8px;
    --unify-dialog-width: 700px;
  }
</style>

<unify-store-availability-widget
  api-key="your-api-key"
  item-id="your-item-id"
></unify-store-availability-widget>

Did this page help you?