Go to content

Add a widget to your website

A Johku widget is installed on a website with two pieces of code: the embed script, which is the same for everyone, is placed in the page's HEAD section, and the widget-specific embed code in the BODY section at the place where you want the widget to appear. The installation is usually done by the website's administrator.

Before you start

The widget must be created in Johku; see Create a widget. The website must support adding scripts to the HEAD and BODY sections. In some content management systems, this can be a paid extra feature.

Install the widget

  1. Open the widget on the Settings → Storefront → Widgets page and copy its Embed code and the general Embed script. The embed script is the same for all widgets and all Johku merchants.

  2. Deliver both pieces of code to your website's administrator.

  3. Ask the administrator to place the embed script in the page's HEAD section. The script is placed only once, even if the page has several widgets.

  4. Ask the administrator to place the widget's embed code in the page's BODY section at the place where you want the widget to appear. You can place the embed codes of several widgets on the same page.

  5. If possible, install the widget on a test page first so that you can check its details and styles at your own pace.

A Category widget

Language-specific embed codes

If your website has language versions, a separate embed code is copied for each language:

  1. In the language selector at the top of the Johku admin, switch to the language you want, one that is in use in your shop.

  2. Open the widget and copy its embed code. You recognize the language version by the locale value in the code: fi_FI is Finnish, en_US English and so on.

  3. Deliver the embed script and all the language-specific embed codes to the website's administrator. Note that the embed code of the Basket widget is language-specific too.

A language-specific embed code shows the product with the details of that language version. Remember to translate the product's name and description texts in Johku so that they are shown correctly in the widget; see What can be translated in Johku. Language versions are enabled on the Settings → General settings → Languages page.

Wix sites

In Wix, embed codes are loaded into fixed areas that have their own HTML page, so the embed script doesn't work when it is placed in the HEAD content of the whole site. Instead, add the embed script to the same Embed HTML code area as the widget's embed code.

Iframe embeds and old embeds

The Johku storefront can't be embedded on another website in an iframe, because moving to the payment provider doesn't work inside the frame. Use widgets, or open the storefront in a new tab from a link on your own website.

Johku's old embeds, whose code starts with https://johku.com/embed/?shopId=, are being phased out and don't support Johku's newest features. Replace them with widgets: remove the old embed codes from the pages and install the embed script and the widgets' embed codes in their place according to these instructions.

Checkout page for an external site

When you sell only with widgets on your own website, you can direct the customer from the Johku checkout page back to your website with the storefront type Checkout page for an external site. The setting hides the menu and the footer categories from the Johku storefront, and clicking the logo at the top takes the customer to the external site you define. The same setting is used when you want to show the results of the Search widget on the storefront without menus. If you want to hide only the footer categories without changing the storefront type, on the Settings → Storefront → Layout tab, under Show navigation in footer, select Hide navigation; see Navigation in the footer.

  1. Open Settings → Storefront → Other and find the Storefront type selector.

  2. From the Storefront type selector, select Checkout page for an external site.

  3. Enter the external site's address, including https://, in the field reserved for it.

  4. Save and test that it works, for example in the product preview.

The Storefront type setting with Checkout page for an external site selected and the External site URL field

Result

The widget is shown on your website at the place where the embed code was placed, and the product's details update in it from Johku in real time. The customer's purchase continues from the widget to the Johku checkout page.

If the widget doesn't show on the website

The most common causes are an embed script missing from the HEAD section, content that is not public and the Wix script restriction. Troubleshooting is collected in The widget doesn't show on your website.