Device API
The Device API provides access to device information and capabilities, allowing you to retrieve device details, check device types, and adapt your extension behavior based on the POS hardware characteristics. The API enables device-aware functionality and responsive design based on device form factors.
Anchor to Use casesUse cases
- Responsive design: Adapt interface layouts based on device form factor (tablet compared to phone).
- Device info: Display device-specific information for troubleshooting or support.
- Device-aware features: Implement functionality like optimized touch targets for different screen sizes.
- Usage analytics: Track device usage patterns for analytics or feature optimization.
Supported targets
- pos.
cart. line-item-details. action. menu-item. render - pos.
cart. line-item-details. action. render - pos.
customer-details. action. menu-item. render - pos.
customer-details. action. render - pos.
customer-details. block. render - pos.
draft-order-details. action. menu-item. render - pos.
draft-order-details. action. render - pos.
draft-order-details. block. render - pos.
exchange. post. action. menu-item. render - pos.
exchange. post. action. render - pos.
exchange. post. block. render - pos.
home. modal. render - pos.
home. tile. render - pos.
order-details. action. menu-item. render - pos.
order-details. action. render - pos.
order-details. block. render - pos.
product-details. action. menu-item. render - pos.
product-details. action. render - pos.
product-details. block. render - pos.
purchase. post. action. menu-item. render - pos.
purchase. post. action. render - pos.
purchase. post. block. render - pos.
register-details. action. menu-item. render - pos.
register-details. action. render - pos.
register-details. block. render - pos.
return. post. action. menu-item. render - pos.
return. post. action. render - pos.
return. post. block. render
Supported targets
- pos.
cart. line-item-details. action. menu-item. render - pos.
cart. line-item-details. action. render - pos.
customer-details. action. menu-item. render - pos.
customer-details. action. render - pos.
customer-details. block. render - pos.
draft-order-details. action. menu-item. render - pos.
draft-order-details. action. render - pos.
draft-order-details. block. render - pos.
exchange. post. action. menu-item. render - pos.
exchange. post. action. render - pos.
exchange. post. block. render - pos.
home. modal. render - pos.
home. tile. render - pos.
order-details. action. menu-item. render - pos.
order-details. action. render - pos.
order-details. block. render - pos.
product-details. action. menu-item. render - pos.
product-details. action. render - pos.
product-details. block. render - pos.
purchase. post. action. menu-item. render - pos.
purchase. post. action. render - pos.
purchase. post. block. render - pos.
register-details. action. menu-item. render - pos.
register-details. action. render - pos.
register-details. block. render - pos.
return. post. action. menu-item. render - pos.
return. post. action. render - pos.
return. post. block. render
Anchor to PropertiesProperties
The shopify global object provides device details and capabilities. Access the following properties on shopify to get device information, check form factors, and manage device registration.
- Anchor to getDeviceIdgetDeviceIdgetDeviceId() => Promise<string>() => Promise<string>requiredrequired
Retrieves the unique string identifier for the device. Returns a promise that resolves to the device ID. Use for device-specific data storage, analytics tracking, or implementing device-based permissions and configurations. Note: While Shopify POS attempts to maintain a stable identifier, it is not guaranteed to be permanent and may change.
- Anchor to isTabletisTabletisTablet() => Promise<boolean>() => Promise<boolean>requiredrequired
Determines whether the device is a tablet form factor. Returns a promise that resolves to
truefor tablets,falsefor other device types. Use for implementing responsive design, optimizing touch targets, or providing device-appropriate user experiences.- Anchor to namenamenamestringstringrequiredrequired
The name of the device as configured by the merchant or system. Use for displaying device information in interfaces, logging, or support contexts where device identification is helpful.
- Anchor to registerNameregisterNameregisterNamestringstringrequiredrequired
A short, unique identifier for the device, assigned by Shopify.
Anchor to Best practicesBest practices
- Implement responsive design: Use device type information to adapt your interface layouts, component sizes, and interaction patterns based on the device form factor and capabilities.
- Handle async device queries: Handle the Promise-based device methods with async/await or
.then()patterns, and implement appropriate error handling for device query failures. - Cache device information appropriately: Consider caching device information after the initial query to avoid repeated async calls, but ensure you handle cases where device characteristics might change during the session.
- Provide device-appropriate experiences: Design different user experiences for tablets versus other devices, taking advantage of larger screens while ensuring functionality works across all supported device types.