Remote widgets - problems & solutions

I had some problems getting remote widgets (https://documentation.vin65.com/Designer-Launch/Vin65-Remote-Widgets) working and wanted to 1. share my solutions and 2. flag this to the WineDirect team.

First, the WineDirect JS file uses a library called js-cookie (https://github.com/js-cookie/js-cookie) which must be included explicitly. So in addition to the WineDirect JS I had to include this, e.g.:

<script src="https://cdn.jsdelivr.net/npm/js-cookie@rc/dist/js.cookie.min.js"></script>

Second, an error was thrown on the following line:

var action = $(form).context.action.split('?method=')[1];

I didn’t have time to properly debug this, but I fixed by changing it to:

var action = $(form).attr('action').split('?method=')[1];

(And then hosted the updated version myself which I realize is probably going to break in the future.)

These are the only issues I’ve run into so far.

WineDirect team - please let me know if I’m missing anything here. These both seemed like bugs to me.

2 Likes

This is so cool of you.

:raised_hands:

Hey @sai,

Thanks for finding these and posting them! :slight_smile:

We’ve been working on some updates to remote tools so there is a new function that needs to be called and should include the js-cookie file for you automatically. (Looks like you caught us right before the documentation was updated - sorry!)

After pulling in the remote script file, call in the following, replacing the URL with the winery’s website URL.
<script type="text/javascript">vin65remote.cart.init('https://generic.vin65.com',0);</script>