bigcommerce/checkout-sdk-js

Customizing embedded checkout

techdaddies-kevin opened this issue · 2 comments

I started a discussion on this repo, but it got no traction. Bigcommerce support will not assist either. Hopefully the devs can help clear up the issue.

I know that we can customize the embedded checkout slightly with onLoad and onComplete events docs but I'm having a terrible time trying to figure out how to actually set up the event syntactically.

Basically, we're using the BigCommerce Wordpress plugin with embedded checkout. The plugin passes the configuration of the checkout via a data-js property, and we can customize that. I have tried various configurations of passing JSON objects into this, but no matter what I do, I cannot get my custom JS to execute. I cannot figure out what syntax the SDK is looking for. All I can create is JS errors in trying to figure out the format.

Any help would be appreciated. If I can just see an example of the data-js JSON that the SDK needs to fire an onLoad event, I can take that and implement it into the WP plugin. But that syntax is the spot we're stuck on currently and my JS chops aren't good enough to figure out what the SDK wants to see.

Hi, thanks for posting this.
If I understood you correctly, the config you are seeking for should be this line. The method to load embedded checkout is here. Think you could follow the config to launch an embedded checkout page.

Yes, that's the line where the Wordpress plugin generates an array of configuration options that is passed to the embedded checkout container. My issue is that I cannot figure out the syntax that the Checkout SDK wants for the events. For example, let's say we want to just do an

alert('test');

in the onLoad event. How would that look in the code?