In the following it is explained how Profity can be integrated into a Woocommerce Shop.

Landingpage Script

Add the following code to the functions.php of your theme. The landingpage script is only needed on the page that is stored at Profity. Normally this is the start page.

Please note that the domain in the Script Tag (https://static.profity.ch/clients/main.js) must be replaced with the country specific Profity Domain:

CH: static.profity.ch
AT: static.profity.at
PL: static.pl.profity.shop
DE: static.shopmate.de
UK: static.profity.uk

/* --------------------------------------------------------------------------
| Profity: Landingpage Script
|-------------------------------------------------------------------------- */
function profity_landingpage() {
  if ( is_page('home') ) {
    ?>
    <script async src="https://PROFITY-DOMAIN/clients/main.js"></script>
    <?php
  }
}
add_action('wp_head', 'profity_landingpage');

Conversion Script

In addition to the landing page script, the conversion script must also be integrated into functions.php.

Please note that the domain in the Script Tag (https://static.profity.ch/clients/conversion.js) must be replaced with the country specific Profity Domain:

CH: static.profity.ch
AT: static.profity.at
PL: static.pl.profity.shop
DE: static.shopmate.de
UK: static.profity.uk

/* --------------------------------------------------------------------------
| Profity: Conversion Tracking
|-------------------------------------------------------------------------- */
function profity_conversion_tracking($order_id) {

  $order = new WC_Order( $order_id );
  $order_value  = $order->order_total;
  $coupons      = $order->get_coupon_codes();

  if( isset($coupons) ):
    foreach( $coupons as $coupon ):
      $voucher = $coupon;
      break;
    endforeach;
  endif;

  ?>
  <script async src="https://PROFITY-DOMAIN/clients/conversion.js?s=PROFITY_ID&ordervalue=<?= $order_value ?>&amp;ordernumber=<?= $order_id ?><?php if( isset($voucher) ): ?>&amp;vouchercode=<?= $voucher; ?><?php endif; ?>&amp;email=<?= $order->billing_email; ?>"></script>
  <?php
}
add_action('woocommerce_thankyou', 'profity_conversion_tracking', 200);

Visual integration

Finally, the third script which is responsible for the visual integration of the gift layer must also be integrated into functions.php.

/* --------------------------------------------------------------------------
| Profity: Geschenk Layer
|-------------------------------------------------------------------------- */
function add_getback() {
  ?>
  <script async src="https://www.getback.ch/Getback_ID"></script>
  <?php
}
add_action('woocommerce_thankyou', 'add_getback');