This guide covers the manual integration of Klarna On-site messaging with a Shopify store when the app isn’t compatible with your store.
The manual integration is considered custom merchant code. You should use it only when it has been confirmed that the On-site messaging app can’t work inyour Shopify store.
You’re responsible for supporting and maintaining the custom code if you choose to integrate OSM manually.
If the Klarna On-site messaging (OSM) Shopify app isn’t compatible with your store, you can integrate Klarna On-site messaging manually or use a combination of the app and custom code.
To make sure on-site messaging complies with legal requirements, make sure that your custom code includes functions that refresh the placements when variants change.
You can find full documentation about using a
Below is an example body of a
POST request that adds a new script tag file to a Shopify store.
For example, if the URL of your Shopify store is https://yourshopifystorename.myshopify.com, the file containing the OSM script can be added to
The specific files to be updated with the OSM placement tags differ between Shopify themes. For example, if you’re using the Brooklyn theme, both the
klarna-placement tag and refresh code are put into the
product.liquid file. The correct liquid variable for the product price, which also depends on the store’s theme, must be used for the placement.
In the example code,
current_variant.price is the correct variable. Depending on your store’s theme and section of code, you may use
current_variant.price, or another liquid variable.
You can find the placement code snippets in Klarna Merchant portal > On-site messaging > Placements.
If the products in your store have variants, you also need to add code to update the Klarna On-site messaging placement when a customer selects a different variant. We've documented this in the frequently asked questions.
Here's an example of code to refresh placements: