• Has anyone successfully extended this plugin to include a share function, ie; adding a unique ID parameter which so a wishlist can be emailed?

    Would need to work without logging in.

Viewing 1 replies (of 1 total)
  • Thread Starter tin_soldier

    (@tin_soldier)

    I’m thinking that the following should work. I’m going to add the following javascript to the wishlist page:

    const currentUrl = window.location.href;
    
    function getParameterValue(parameterName, url) {
      const params = new URLSearchParams(url.search);
      return params.get(parameterName);
    }
    
    const itemsValue = getParameterValue('items', new URL(currentUrl));
    
    if (itemsValue) {
      // Add the value to the localStorage variable
      localStorage.setItem('ccc-my_favorite_post', itemsValue);
    }

    Which means the page will be listening for ?items=”” with comma separated post IDs as the value and adds them to the localStorage variable My Favorites uses, essentially filling the wishlist.

    Now I just need to make a Share button that takes the ccc-my_favorite_post variable and makes a link such as https://www.mysite.com/wishlist?items=”xxx,xxx,xxx”

    Can anyone forsee any issues with this approach?

Viewing 1 replies (of 1 total)
  • The topic ‘Share guest wishlist’ is closed to new replies.