The instructions say to include your Snipcart API keys, I have tried including them in the index.php file of the plugin, and the config.php of my site, and both are not working:
(below: in config.php)
I have no doubt this is basic for most, please let me know if someone can help out.
Such an awesome looking plugin, will definitely send jimbobrjames some € for their time
It should not be wrapped in option() in config.php. You may need to revert the changes to you made to the plugin before it will work.
On a side note, i do know there were some recent major changes made to Snipcarts features and i have not yet had the time to check if that causes any issues for the the plugin. However, i will do in the next few days.
Ah ok I got it to work now- I changed some of the code in the product-add-to-cart.php file to reflect all the info I have for the products in the dashboard.
This might be pushing my luck, but do you have an idea of how you would allow a user-selected size variation get sent to the Snipcart button?
If I have these options that I want users to select before clicking Add to Cart, do you have an idea of how to send it to the custom field in the Snipcart button?
I tried using a PHP cookie, where I saved the user-selected size and sent it over to Snipcart like this:
...
data-item-custom1-name="Size"
data-item-custom1-options="<?= $_COOKIE['sizechoice'] ?>">
Add to cart
</button>
but , when a user would go back to select a new size it would still keep the old cookie value (I wasn’t sure how to reset it).
Does anyone have a better solution to send that selected size info into that Snipcart button? I have a less elegant workaround that I can use, so really happy to drop it here.
Thanks for all your help🙏
Yes you can do this by updating the data attributes after page load with javascript based on user choice. There is example of this in the Snipcart documentation. See here: