Shopify Plus merchants can use custom scripts to customize their payment methods(s) presentation in Shopify checkout, based on available cart data, as documented below. Please note: Klarna is not responsible for this sample code; merchants should review & test this code in their store. Shopify has example payment script code here.
Even though the name of Klarna appears differently in checkout with a different translation per language, as documented here, Script Editor custom code should reference the name of the payment method configured in the app's payment method extension, which for this integration, is "Klarna".
Each store should customize the code below to use the appropriate data for the store.
Shopify only allows a single script to be published for each script type [Line Items, Shipping, Payments]; the code examples below likely require modifications to be combined into a single script.
The code below was copied, and slightly modified match the payment method/gateway names, from Shopify’s example code for the “Reorder payment gateways” in the Script Editor app. Shopify published example code to reorder gateways is available here.