Code Queen

Sep 14, 20201 min

Wishlist Code (Part 1, Dec. 2017)

Tutorial Video

Code Queen Nayeli walks you step by step on how to create a Wish List using Wix Code on your Wix website. Wix Code is now available on ALL Wix accounts!


 

Follow Along #1

Tutorial Page

https://codequeen.wixsite.com/wishlist


Good to Know #1

The Code

Be sure to watch the tutorial video above to understand the code and how to modify it.


 
import wixUsers from 'wix-users';
 
import wixData from 'wix-data';
 

 
$w.onReady( () => {
 
if(wixUsers.currentUser.loggedIn) {
 
$w("#addtowishlist").label = "ADD TO WISH LIST";
 
}
 
else {
 
$w("#addtowishlist").label = "SIGN IN TO SAVE";
 
}
 
} );
 

 
export function addtowishlist_onclick() {
 
wixData.insert('wishlist',
 
{wishlist_item: $w('#Itemdetails').getCurrentItem()._id}),
 
$w('#success').show(), //These are extra lines in case you have buttons or other
 
$w('#addtowishlist').hide(), //These are extra lines in case you have buttons or other
 
$w('#viewlist').show(); //These are extra lines in case you have buttons or other
 
}


Author

by Code Queen

Stuck on a project? Hire Code Queen, LLC!

Schedule a phone call or video call directly online. In a different time zone? No problem! Code Queen currently has clients around the world.

Online Booking: Discovery Session

Contact Form: Send project details

    3230
    9