Obviously I am new and attempting my first Shopify App. I choose to use PHP / Javascript.
In the below code example on my test store I can successfully Select Products through the Button. Checked the console and the correct selected array exists. Yay! However, I am trying to use Cookies to save the Selected list. And there is no output from: print_r(selected);
Can some kind soul please tell me what I am doing incorrectly or if there is a better way to return the selected array?
It looks like you’re not setting the cookie for the selected products in your JavaScript code. The selected products are being logged to the console, but they’re not being saved to a cookie.
You can set the cookie in your JavaScript code right after logging the selected products to the console. You may need to stringify the selected products array because cookies can only store strings. Then, in your PHP code, you can retrieve and decode the cookie.