Learn how to customize your payment methods in Shopify Plus.
Shopify Scripts are being deprecated and will no longer be supported as of August 28, 2025. Scripts are replaced by apps powered by Shopify Functions. For any new integration, you will need to use such an app for checkout customization. Apps such as HidePay, Payfy and BeSure can be utilized to hide Klarna for certain markets, products, or other conditions.
Shopify Plus merchants can use custom scripts to customize their payment methods in Shopify’s checkout, based on available cart data, as documented below.
Shopify documentation has an example payment script code. Note that Klarna isn’t responsible for this sample code. You have to review and test this code in your store.
To start using custom scripts, go to the Script Editor app and follow the instructions in Shopify documentation.
Even though the name of Klarna appears differently in checkout with a different translation per language, as documented in this article, 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.
For each store, you have to 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, for example, Line Items, Shipping, Payments, etc. The code examples below likely require modifications to be combined into a single script.
The code below was copied from Shopify’s example code for the Reorder payment gateways in the Script Editor app.It is slightly modified to match the payment method/gateway names.
You can view the original Reorder gateways code example published in Shopify documentation.
This code lets you hide payment methods depending on the cart presentment currency, that is, the customer’s local currency.
This code lets you hide payment gateways for specific countries, based on the customer's shipping address. You can view the original Hide gateways for specific countries code published in Shopify documentation.
The Shopify API doesn’t provide billing address cart data as parameters for payment gateway custom scripts since the billing address is entered by the customer on the same page where the payment gateway custom script is run.
This code lets you hide payment gateways for specific products, for example, gift cards. You can view the original Hide gateways for specific products code published in Shopify documentation.
This code lets you hide Klarna payment methods based on product tags.