Skip to main content
All CollectionsAppointments & Events Bookings
How to only allow people who have purchased a certain product to book an appointment?
How to only allow people who have purchased a certain product to book an appointment?
Support avatar
Written by Support
Updated over a week ago

2.. Create a collection and make it unavailable on the store and add the appointment you only want people who purchased a certain product to get. This will cause the appointment in the collection to be hidden and only available for those that have a direct link.

3. We will be using this code in order to redirect the customer after the purchase of a product to the book appointment page.

<script>
try {
let redirect_url = 'product_URL';
let redirect_prod_ids = [product_id];

let order_line_items = Shopify.checkout.line_items;
for( var i=0; i<order_line_items.length; i++ ){
if( redirect_prod_ids.includes( order_line_items[i].product_id ) ){
window.top.location.href = redirect_url;
}
}
}catch(err){
//if errors happen in the above code, do nothing
}
</script>

4. Get the product id for the product that will be used to redirect the customer to the booking of an appointment after purchase. You can get this from the product settings section. For example, the highlighted section here:


let redirect_prod_ids = [product_id];

5. Then for the product_URL put in the store URL for the appointment page.

let redirect_url = 'product_URL';

6. Then, put this code into the settings for your checkout in the additional scripts section:

7. Now when someone buys that certain product they will be sent to the hidden appointment page that you have setup.

Other articles to refer to for information on events within the store space:
How to add images to your event?
View Products and Orders for the events.
How to move your event product to separate collection?

Did this answer your question?