Klarna On-Site Messaging for WooCommerce
Provides Klarna On-Site Messaging for WooCommerce
by krokedil, klarna · github.com/krokedil/klarna-onsite-messaging-for-woocommerce
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/krokedil/klarna-onsite-messaging-for-woocommerce/archive/refs/heads/master.zipReadme
Klarna On-Site Messaging for WooCommerce plugin
Requires either Klarna Checkout for WooCommerce or Klarna Payments for WooCommerce to be installed
Installation
To install this plugin you first need to have either Klarna Checkout for WooCommerce or Klarna Payments for WooCommerce installed. You can find the links to this above. You install this plugin just like any other WordPress plugin:
- Download and unzip the latest release zip file.
- If you use the WordPress plugin uploader to install this plugin skip to step 4.
- Upload the entire plugin directory to your /wp-content/plugins/ directory.
- Activate the plugin through the ‘Plugins’ menu in WordPress Administration.
You also need a few things from Klarna to integrate On-Site Messaging. The Data client ID and Placement data keys for product page placement and/or cart page placement. You can get both the Data client ID and the Placement data keys from your Klarna merchant portal. You can find more information about that here.
Then go to the settings for either the Klarna Checkout or Klarna Payments gateway ( WooCommerce –> Settings –> Payments ). At the bottom of these pages you should now see a section called Klarna On-Site Messaging. Here you can enter the Data client ID and your Placement data keys.
Now when you go to either your product or cart page you should be seeing the widget that you set up in your merchant portal.
Changing widget location.
In your Klarna settings there is a select option to select where on the page you want to display the widgets.
You can also change the location of the individual widget by using the following filters:
- klarna_onsite_messaging_product_target for the Product page placement action.
- klarna_onsite_messaging_product_priority for the Product page priority.
- klarna_onsite_messaging_cart_target for the Cart page placement action.
- klarna_onsite_messaging_cart_priority for the Cart page priority.
Code example
<?php
// Change the placement action for the widget.
add_filter( 'klarna_onsite_messaging_cart_target', 'change_klarna_onsite_messaging_cart_location' );
function change_klarna_onsite_messaging_cart_location( $location ) {
// Here you need to replace the $location variable with the action that you want to use instead of the default.
// You can also add custom checks to apply different locations depending on your needs.
$location = 'woocommerce_after_cart';
return $location;
}
// Change the priority for the action for the widget.
add_filter( 'klarna_onsite_messaging_cart_priority', 'change_klarna_onsite_messaging_cart_priority );
function change_klarna_onsite_messaging_cart_priority( $priority ) {
// Here you need to replace the $priority variable with the action that you want to use instead of the default.
// You can also add custom checks to apply different priority depending on your needs.
$priority = '10';
return $priority;
}
These can be used with any action that you want. You can find a list of all WooCommerce actions and where they operate here
We do not support individual themes. If you want to change the appearance of the widget outside of what we can do with the filter then this requires custom CSS code. Use the classes klarna-onsite-messaging-product and klarna-onsite-messaging-cart respectively.
Read the full README on GitHub →
Releases
| Tag | Published |
|---|---|
| 1.13.0 | Aug 23, 2023 |
| 1.12.0 | Jun 19, 2023 |
| 1.11.0 | Mar 23, 2023 |
| 1.10.0 | Dec 8, 2022 |
| 1.9.0 | Oct 10, 2022 |
| 1.8.0 | Jun 28, 2022 |
| 1.7.1 | May 24, 2022 |
| 1.7.0 | May 12, 2022 |
| 1.6.3 | Apr 6, 2022 |
| 1.6.2 | Mar 1, 2022 |
| 1.6.0 | Nov 29, 2021 |
| 1.5.1 | May 31, 2021 |
| 1.4.4 | Feb 25, 2021 |
| 1.4.3 | Nov 24, 2020 |
| 1.4.2 | Oct 2, 2020 |
| 1.4.1 | Sep 22, 2020 |
| 1.4.0 | Sep 15, 2020 |
| 1.3.1 | Aug 11, 2020 |
| 1.3.0 | Aug 11, 2020 |
| 1.2.2 | Jun 2, 2020 |
| 1.2.1 | Mar 4, 2020 |
| 1.2.0 | Mar 3, 2020 |
| 1.1.0 | Mar 2, 2020 |
| 1.0.5 | Oct 22, 2019 |
| 1.0.4 | Jun 12, 2019 |
These releases are tags only. The author does not attach a packaged zip, so there are no download counts to report.