Skip to content

Expose Shopify handle.js data as a Preact hook: useShopifyProduct(handle: string) #426

@timowestnosto

Description

@timowestnosto

Description:
Create a new Preact hook, useShopifyProduct(handle: string), that fetches and exposes product data from Shopify’s handle.js endpoint. This will allow components to easily retrieve and use Shopify product data by handle within the Preact application.

Acceptance Criteria:

  • Implement a hook useShopifyProduct(handle: string) in src/hooks/useShopifyProduct.ts.
  • The hook should fetch product data from /products/${handle}.js.
  • The hook should return loading, error, and product data states.
  • The hook should cache results per handle to avoid unnecessary network requests.
  • Add unit tests for the hook to cover loading, error, and success states.
  • Update documentation to describe usage of the new hook.

References:

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions