This type of integration is considered custom merchant code and should only be used when confirmed that the On-site messaging app can’t work on a Shopify store. Merchants are responsible for supporting this code when this approach.
If directly inserting On-site messaging into a Shopify theme without the app, to be legally compliant with accurate on-site messaging, make sure to code for refreshing the placements when variants change. Note: If the app code is still active, the app will refresh both manual placements and app placements when variants change, but manual placements will only display if the app has one active placement (even if that doesn’t display on the front end).
Below is an example
BODY of the
POST call to add a new script to a Shopify store, e.g. https://yourshopifystorename.myshopify.com/admin/script_tags.json:
The appropriate theme files to update with Klarna On-Site Marketing placement tags & refresh code are dependent upon the Shopify theme you are using. For an example, using the Brooklyn theme, both the klarna-placement tag and refresh code are put into product.liquid. The appropriate liquid variable for the product price, which is also dependent on the store’s theme, must be used for the placement. In the example below, current_variant.price the appropriate variable. Depending on your store’s theme and section of code, you may use variant.price, current_variant.price, or another liquid variable.
Below is an example of placement code for a Shopify theme, which is also available in the Klarna Merchant Portal, and documented at: installation
If your store has products with variants, you will also need to add code to update the on-site messaging placement when the customer selects a different variant, as documented on the faq.
Below is an example of refresh code: