Webflow sync, pageviews & more.
NEW
Answers

How can I password protect certain products in an e-commerce website created on Webflow? I have a password protected page with various products that should only be visible for 48 hours before being released to the public. However, since each product shares the same template, they are not currently password protected. Is there a way to add code to the product page template to password protect only the products tagged as "Scarab Preview"?

Yes, you can add code to the product page template in Webflow to password protect only certain products tagged as "Scarab Preview". Here's how you can achieve this:

1. Tag the products: In your Webflow CMS, make sure the products you want to password protect are tagged with a specific tag, in this case, "Scarab Preview". You can add this tag as a multi-reference field in your product collection.

2. Create a password protected page: Create a new page in Webflow and set it as a password protected page. This will require users to enter a password before accessing the page.

3. Create a dynamic list: On the password protected page, create a dynamic list element that connects to your product collection. This list will display the products tagged as "Scarab Preview".

4. Set filter conditions: In the dynamic list settings, set the filter conditions to only show products with the tag "Scarab Preview". This way, only those products will be displayed on the password protected page.

5. Set time-based visibility: To make the page visible for 48 hours, you'll need to add custom code to calculate the current time and compare it with the release time. You can achieve this by adding custom code to the page's head tag or using custom code embeds.

- Get the current time using JavaScript's `Date()` object.
- Compare the current time with the release time, which can be stored as a custom field in the product collection.
- If the release time is within the last 48 hours, set the page's visibility to be visible. Otherwise, hide the page.

6. Configure other settings: Customize the styling of the page, set up the password input field, and add any other necessary information.

By following these steps, you'll be able to password protect only the products tagged as "Scarab Preview" and display them on a password-protected page for 48 hours before they are released to the public.

Rate this answer

Other Webflow Questions