Interfaces
ModuleOptions
Properties
ProductInfo
Properties
UseProductSeoDataReturn
Properties
Property | Type | Description |
---|---|---|
canonicalLink | ComputedRef <CanonicalLink > | Computed ref for canonical link tag metadata. |
productBreadcrumbJsonLd | ComputedRef <WithContext <BreadcrumbListLeaf >> | Computed ref containing JSON-LD structured data for product breadcrumbs. |
productJsonLd | ComputedRef <WithContext <ProductGroupLeaf >> | Computed ref containing JSON-LD structured data for the product group. |
robots | string | Robots meta tag value, typically "index, follow". |
title | ComputedRef <string > | The title of the product. |
UseRecentlyViewedProductsOptions
This composable can be used to track a short history of products a customer has previously viewed using local storage. It maintains up to 10 recently viewed products and provides methods to add new products and fetch their full details.
Param
An object containing parameters and options for the loading the products.
Param
The fields to include in the response.
Param
The price promotion key.
Properties
UseRecentlyViewedProductsReturn
Properties
Property | Type | Description |
---|---|---|
addProductId | (productId : number ) => void | Adds a product id to the list of recently viewed products and persists it to local storage. Because this function uses local storage, it is not available on the server. Throws Error if the function is called on the server. |
error | Ref < | undefined | Error > | A reactive container for any errors that occur during fetching. |
loading | Ref <boolean > | A reactive flag indicating if the product data is being fetched. |
loadMissingProducts | () => Promise <void > | Loads products based on the product ids previously added. Initially all products within the persisted list are loaded. Subsequent calls only load products that are not already loaded. Because this function uses local storage, it is not available on the server. Throws Error if the function is called on the server. |
products | Ref <Product > | A reactive array of the fetched, full Product objects. |
status | Ref <AsyncDataRequestStatus > | A string indicating the status of the data request |
Type Aliases
CanonicalLink
ShopProduct
Type Declaration
Name | Type |
---|---|
product | Product |
UrlParams
Variables
module
Functions
useAllShopProductsForId()
Type Parameters
Type Parameter | Default type |
---|---|
DataT | ShopProduct |
PickKeys extends KeysOf <DataT > | KeysOf <DataT > |
DefaultT | null |
Parameters
Parameter | Type | Default value |
---|---|---|
__namedParameters | Partial <{ options : UseRpcOptions <..., ..., ..., ...>; params : MaybeRefOrGetter <...>; }> | {} |
key | string | 'useAllShopProductsById' |
Returns
UseRpcReturn
<"getAllShopProductsForId"
, DataT
, PickKeys
, DefaultT
>
useProductSeoData()
Composable function to generate SEO-related data for a product page.
Parameters
Parameter | Type | Description |
---|---|---|
breadcrumbs | MaybeRefOrGetter <BreadcrumbItem > | Array of breadcrumb items representing the navigation path to the product. |
urlParams | MaybeRefOrGetter <UrlParams > | Object containing baseUrl and fullPath to build and sanitize canonicalUrl. |
productInfo | MaybeRefOrGetter <ProductInfo > | Object containing product information including name, brand, description, and variants. |
Returns
An object containing SEO data for the product page with following properties:
useRecentlyViewedProducts()
Parameters
Parameter | Type |
---|---|
options? | UseRecentlyViewedProductsOptions |