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?