Skip to main content
shoppy.customer.recover(email)
Sends a password reset email to the customer. The email contains a link to reset their password.

Parameters

ParamTypeRequiredDescription
emailstringYesCustomer’s email address

Returns

Promise<void>

Throws

  • Error - If the email is invalid or not found.

Examples

Basic password recovery

try {
    await shoppy.customer.recover('[email protected]')
    showMessage('Check your email for reset instructions')
} catch (error) {
    showError(error.message)
}

Forgot password form

document.querySelector('#forgot-form').addEventListener('submit', async (e) => {
    e.preventDefault()

    const email = document.querySelector('#email').value
    const button = document.querySelector('#submit-btn')

    button.disabled = true
    button.textContent = 'Sending...'

    try {
        await shoppy.customer.recover(email)

        showSuccess(`
            Password reset email sent to ${email}.
            Check your inbox and follow the link to reset your password.
        `)

        // Optionally redirect to login
        setTimeout(() => {
            window.location.href = '/login'
        }, 3000)
    } catch (error) {
        showError('Could not send reset email. Please check your email address.')
    } finally {
        button.disabled = false
        button.textContent = 'Send Reset Email'
    }
})
The reset email is sent by Shopify and uses your store’s email templates. Customize the template in Shopify Admin → Settings → Notifications.