JavaScript Event for Recipe Rating
Recipe Kit fires a JavaScript event when a customer rates a recipe. Use it to trigger anything you like on your own site.
Listening for the event
Add this to your theme's JavaScript, or to the Custom JS field in the Recipe Kit app block settings:
document.addEventListener('rk_rating_event', function (e) {
console.log('Recipe Kit rating submitted');
// Your code here, for example:
// - show a thank you message
// - fire a confetti animation
// - open an email signup prompt
// - send an event to your analytics
}, false);
The event fires immediately after a rating is submitted, on any recipe card on the page.
The cart event
There is a separate event for cart changes, rk_cart_event, which fires whenever an ingredient is added to or removed from the cart and carries the updated cart in e.detail.cart. See Shoppable recipe / add to cart does not update theme cart.
What's next
- Adding blog comments / text reviews - Collecting written reviews alongside ratings
- Custom CSS Styling - Styling the rating stars