You can loop through your subscriptions and see if the order.buyer.id matches the member ._id and is active
import { currentMember } from "wix-members-frontend";
import wixPricingPlans from 'wix-pricing-plans-frontend';
$w.onReady(() => {
wixPricingPlans.orders.listCurrentMemberOrders().then((orders) => {
getMemberInfo(orders);
}).catch((error) => {
console.error('Error Getting All Orders')
console.error(error);
});
});
function getMemberInfo(orders) {
currentMember
.getMember()
.then((member) => {
checkForMemberShip(member, orders);
})
.catch((error) => {
console.error('Error Getting Member Info')
console.error(error);
});
}
let hasActivePlan = false;
function checkForMemberShip(member, orders) {
console.log(member._id, orders);
for (let i = 0; i < orders.length; i++) {
if (orders[i].buyer.memberId === member._id && orders[i].status === "Active") {
hasActivePlan === true;
console.log(hasActivePlan);
break;
}
}
}