The Static Widget enables merchants to integrate the Sezzle widget into their website without direct communication with Sezzle’s servers. All widget code, custom configurations, images, and stylesheets are hosted locally within the merchant’s store theme. This approach offers:
Faster Load Times
Local hosting reduces dependency on external servers.
Greater Control
Merchants have full authority over the widget’s appearance and behavior, as the Sezzle team cannot modify it.
This local control means merchants are responsible for any updates or changes to the widget.
If your website is built with React, please refer to the package and documentation here.
Using npm:
npm install @sezzle/sezzle-static-widget@latestWithin your product page, add the following code snippet where you want the widget to render, updating the path to node_modules for your file structure:
Implementation varies greatly by platform, theme, etc. Below is a general overview of the process. The code snippets below are samples and may need to be modified to fit your site. For Shopify merchants, please proceed to the next section.
Create a new Javascript file within your site’s code where appropriate
Create a placeholder element where the Sezzle widget should be rendered on the page(s), usually below the price container element
Copy
Ask AI
<div id="sezzle-widget"></div>
Add the following script below the placeholder element, updating the amount value to reflect your price variable which renders the current product price or cart total as applicable
Copy
Ask AI
<script> var renderSezzle = new AwesomeSezzle({ amount: `${yourPriceVariableHere}`, }); renderSezzle.init();</script>
Preview your changes to confirm the widget is displaying correctly in each of the following scenarios
Use the Configuration options below to customize the widget appearance as desired:
Next to the theme you wish to edit, click Actions, then select Edit Code
Under the Assets folder, click Add a new asset
On the Create a Blank File tab, name the file sezzle-static-widget and select .js as the file type, then click Add Asset
Copy the code from the repository file and paste it into this new file, then click Save
Add the following lines of code wherever the widget should render on the product page within templates/product.liquid or sections/product-template.liquid as applicable
Copy
Ask AI
<!-- Sezzle Static Widget --><div id="sezzle-widget"></div>{{ 'sezzle-static-widget.js' | asset_url | script_tag }}<script> var renderSezzle = new AwesomeSezzle({ amount: "{{ product.selected_or_first_available_variant.price | money }}", }); renderSezzle.init(); document.onchange = function () { var newPrice = "{{product.selected_or_first_available_variant.price | money}}"; renderSezzle.alterPrice(newPrice); };</script><!-- End Sezzle Static Widget -->
Add the following lines of code wherever the widget should render on the cart page within templates/cart.liquid or sections/cart-template.liquid as applicable
Once the widget is rendering, additional configurations can be added to the AwesomeSezzle to change the appearance. Below is an example featuring all the options. However, amount is the only required value.
The following functions are built into the static widget and are ready for use for your widget installation. Simply add the applicable snippet to your webpage code, updating the event listener and variables as necessary.
Alters price on widget. Create an event listener after renderSezzle.init() that invokes this function where newPrice is the new price value of the selected variant. Example:
Copy
Ask AI
document.onchange = function () { var newPrice = "${yourPriceVariableHere}"; renderSezzle.alterPrice(newPrice);};
Opens the Sezzle modal by a function. Create an event listener that invokes this function if the event location is other than the info icon.
Copy
Ask AI
var clickElement = document.querySelector("#yourClickableElementIdHere");clickElement.addEventListener("click", function () { renderSezzle.renderModalByfunction();});
Returns Element where the widget will be rendered. Create an event listener that invokes this function if the widget should appear when the event occurs.