Hi,
I am very new to coding and velo and really need some help.
On my page I am trying to:
- Member opens “My Diet Plans” Page from menu
- On loading the page queries the Paid Plans/Plans dataset
- If the member has the diet plan named “Diet Plan 1200” the button to access that plan is displayed (and so on for the other diet plans)
- Button sends then to the link for the dynamic page for that plan
Below is a screenshot and the code I have used. It doesn’t work at all. Any advice gratefully received.
import wixData from ‘wix-data’ ;
import wixPricingPlans from ‘wix-pricing-plans’ ;
import { orders } from ‘wix-pricing-plans’
$w . onReady (() => {
getPlan ();
});
function getPlan ( ) {
wixData . query ( “PaidPlans/Plans” )
. eq ( “Diet Plan 1200” )
. find ()
. then (( results ) => {
if ( results . items {
let items = results . items ;
let item = items [ 0 ];
$w ( ‘#diet1200Button’ ). show ();
$w ( ‘#diet1300Button’ ). hide ();
} else {
$w ( ‘#diet1200Button’ ). hide ();
$w ( ‘#diet1300Button’ ). hide ();
}
})
. catch ( ( error ) => {
let errorMsg = error . message ;
let code = error . code ;
});
}
})
}
})
}