With the Sauce Multi-store feature, you can have multiple Sauce accounts associated with a single Instagram account. One such use case is where you have a single Instagram account, but you have multiple languages for your store - each of which has its own URL. In this scenario, you can have a Sauce account for each language, where each has its own curated feed, with product tags that link to the corresponding store.
This article assumes you are using the WPML WordPress Multilingual Plugin, and requires the use of the Code Snippets plugin, although if you are comfortable modifying the WordPress functions.php
, then you can of course install the conversion code that way.
It also assumes that you already have your multiple Sauce accounts set up, where you may have each account with a prefix matching the language: example_de
for your German URLs, example_nl
for your Dutch URLs, and so on.
1️⃣ Install the Code Snippets Plugin
This plugin allows for the easy addition of code snippets to your WordPress website, to remove the need to modify the functions.php
of your store.
2️⃣ Remove the Account ID from the Sauce section of your back office
The Sauce plugin by default assumes the single Sauce account. Given that we want to manually control the conversion code here - remove your Sauce ID from the section of your WordPress back office, then click to save changes.
2️⃣ Customise the Sauce WordPress multi-language conversion code
The following code is similar to the usual Sauce conversion code for WordPress (which the Sauce WordPress plugin automatically sets up for you), with the addition of having the Sauce account ID vary based on the current language of the store.
// add SNPT conversion code to thank you page,
// with the SNPT account ID based on current language
add_action('woocommerce_thankyou', 'snpt_conversion_code');
function snpt_conversion_code( $order_id ) {
$order = wc_get_order($order_id);
if(!$order) { return; }
if(!defined("ICL_LANGUAGE_CODE")) { return; }
$order_number = $order-> get_order_number();
$order_currency = $order-> get_currency();
$order_total = $order-> get_total();
if(ICL_LANGUAGE_CODE == 'en') {
$account_id = 'example-123';
} elseif(ICL_LANGUAGE_CODE == 'de') {
$account_id = 'example-456';
}
$snapppt_conversion_code = <<<EOT
<!-- SNPT conversion code -->
<script>
window.snapppt_order_number = '$order_number';
window.snapppt_order_total = '$order_total';
window.snapppt_order_currency = '$order_currency';
window.snapppt_account = '$account_id';
window.snapppt_platform = 'woocommerce';
</script>
<script src="//snapppt.com/conversion-tracker.js"></script>
EOT;
echo($snapppt_conversion_code);
}
3️⃣ Add your customised conversion code as a Code Snippet
From here, head back into your WordPress account, click into the Snippets sidebar section added by the Code Snippets plugin and paste in your customised conversion code.
As noted in the screenshot below, add each of your languages, along with the corresponding Sauce account ID for each of your Sauce stores - you'll find the Account ID in the 'Account Details' section.
From here, run a test order through your store to confirm all is working. Should you need any help from this point, you know where to find us 🙌🏻