Skip to main content

Type Alias: GetShortcode()

GetShortcode = (productId, variantCode?) => Promise<string>

Generates a unique shortcode for a specific product configuration.

This method creates a persistent, shareable identifier for a specific product configuration. The same product-configuration pair will always generate the same shortcode, allowing for consistent referencing.

Shortcodes are used for sharing configurations, creating AR experiences, and referencing specific states in marketing materials or e-commerce.

Note: Shortcodes are returned as part of the mimeeq-add-to-cart event. There is also configurationShortCode observer - please use them rather than through this method.

Parameters

productId

string

Unique identifier for the product

variantCode?

string

Configuration code string representing the selected options

Returns

Promise<string>

A promise resolving to the generated shortcode string

Example

// Generate a shortcode for the current product configuration
window.mimeeqApp.utils.getShortcode('prod_123', 'A1-B2-C3')
.then(shortcode => {
console.log(`Shareable configuration link: https://example.com/config/${shortcode}`);
});