• Hi guys,

    I’m working on a site that requires some sort of ‘Add to collection’ or ‘Save for later’ functionality on a custom post type.

    I want the user, having logged in, to be able to browse through a range of products on the page and click an ‘Add to collection’ button so that they can return to the product later.

    The main reason for this is so that I can see what products my users are interested in. What’s the best way for me to go about this? Is there a plugin that I can use as the basis for this functionality?

    Thanks

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Sorry for the slow response, I’ve been away.

    I’m no expert in available plugins, but I would expect e-commerce plugins to have this functionality. It’s not too complex of a custom coding project, depending on how you decide to implement it.

    The saved values can be simply stored in an array as a usermeta value. That’s simple enough, the complexity comes from the user interface. Submitting the current product to the server is typically done as an AJAX request so the process does not disrupt the user’s normal browsing. AJAX in itself can be confusing if you are new to it.

    There is a simpler variant that does not require javascript, requests are passed through admin-post.php (GET requests are handled here as well). Besides passing the current product ID, an action parameter is passed which determines in part the action you hook to set up your callback which adds the passed parameter to the usermeta.

    You’re also going to need a page which displays all of the saved products, this can be handled much like a WP post archive template handles posts.

    I’m hoping this is enough to get you started, I’ve left out a lot of important details. Hopefully you can fill in the gaps. If not, ask for clarification on anything you find confusing. Good Luck!

Viewing 1 replies (of 1 total)
  • The topic ‘Best way to set up 'Add to collection' or 'Save for later' functionality?’ is closed to new replies.