How can my customers receive emails when my products are back in stock?

Support-billede
By Morten Vadskær
more than 2 weeks ago
Approx. 1-2 minutes

For your customers to receive an email when an out-of-stock item comes back in stock, you need two things:

#1 An email template called in_stock_mail.html in your theme.
#2 A form on your product page.

The form itself looks like this
How to do it. To do the above, you need to implement the following in your theme:

<form action="" method="post">
<input type="hidden" name="out_of_stock_signup" value="1"/>
<input type="hidden" name="product_id" value="<{$product->getProductId()}>"/>
<input type="email" name="email" placeholder="Your email address"/>

<label>
<input type="checkbox" name="newsletter" value="1"/>
Also subscribe to newsletter
</label>

<input type="submit" value="Subscribe"/>
</form>

The out_of_stock_signup, product_id and email fields are important in the above.

If you want to receive the variant you need to include the attribute_value_id field which is the ID of the variant.

When your product is in stock, the email is sent from the in_stock_mail.html template. If you use variants, the name of the variant will be in the $variant_name variable.

You can see who is subscribed to the email from the product overview in admin.

This website uses cookies.

We use cookies to personalize content and ads, provide social media features, and analyze our web traffic.

Information about your use of our website is also shared with our partners within social media, advertising, and analysis, who may combine them with other data from your interactions with their services.

Read more about our cookies