Question:
Currently, my events are for specific plan holders only, hence the page permissions.
I want to ‘not show’ the plans-pricing page because it says “Get a pricing plan to access this page…” instead direct them over to my memberships page.
Product:
Wix Editor
What are you trying to achieve:
This is my code right now:
import wixUsers from 'wix-users';
import wixLocation from 'wix-location';
let isRedirecting = false;
$w.onReady(function () {
// Check if the user is logged in and not already redirecting
if (!isRedirecting && wixUsers.currentUser.loggedIn) {
// Check if redirected from plans-pricing
const isPlansPricing = wixLocation.url.includes("/plans-pricing") && wixLocation.url.includes("appSectionParams");
if (isPlansPricing) {
// Set the flag to prevent multiple redirections
isRedirecting = true;
// Redirect to memberships URL with no delay
wixLocation.to('/memberships', {suppressHistory: true});
return; // Add this line to prevent the rest of the code from executing
}
}
// Continue with your existing logic for active pricing plans, allowed plans, and other actions
// ...
// Example: Redirect to the upgrade page for users with specific plans
// wixPaidPlans.getPricingPlans()
// .then((plans) => {
// // Your existing logic here
// })
// .catch((error) => {
// console.error("Error fetching pricing plans", error);
// });
});
If you go to https://www.findyourtribe.co.nz/nelson-events and tries to RSVP (after signing up or log in), it will direct to /memberships but it still shows the plans-pricing page. Please see video - Screen Recording 2023-12-29 at 6.33.06 AM.mov - Google Drive
What have you already tried:
Checked forum articles
Modify code, add timeout, remove timeout
Additional information:
NA