Skip to main content

useRecentProducts

The useRecentProducts hook fetches products the user recently viewed in the Shop app, ordered by recency. You can use this to create 'Continue Shopping' sections or personalized product recommendations based on browsing history.

Anchor to params
params

Examples

tsx

import {useEffect} from 'react'

import {useRecentProducts, Button} from '@shopify/shop-minis-react'

export default function MyComponent() {
const {products, fetchMore} = useRecentProducts({first: 10})

useEffect(() => {
console.log(products)
}, [products])

return <Button onClick={fetchMore}>Fetch more</Button>
}

Was this page helpful?