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

250 views0 comments

disclaimer

a quick note about our website content

Our free and premium content is non-exclusive, meaning you are not the only one with access to the content. You can customize our content to fit your end product. Redistribution of our content is strictly prohibited. This means you cannot make our content available to others as-is, stand-alone products or stock products in ANY LANGUAGE, regardless if you offer our content for free or not.