Custom price in with Wix forms

Hi, so i am making a website that allows people to signup for a membership at a sports club. I have a form where they fill out their information. One of the fields in this form is a membership type field (multiple choice). I have wrote some code to change a variables value depending on the users selection (the variable is “totalPrice”). So that part is working perfectly, but i want to know is there a way to then link that variable up to wix forms payment so their end price is related to their selection in the form.

Here is the form:


Here is the code:

$w.onReady( function () {
getPrice();

});

function getPrice() {
var totalPrice = 0;

if ($w(‘#MembershipType’).value === ‘Under 18’) {
totalPrice = 100;
} else if ($w(‘#MembershipType’).value === ‘Student-Unemployed’) {
totalPrice = 140;
} else if ($w(‘#MembershipType’).value === ‘Full Senior’) {
totalPrice = 180;
}

console.log(totalPrice); 

}

export function MembershipType_change(event) {
getPrice();
}

Thanks in advance, James.

1 Like

Any luck on this?