Cashback Tracker WP Plugin
  • Welcome
  • Getting Started
  • Installation & updating
  • How do your cashback website work
  • Quick start
  • Affiliate networks
  • Admitad
  • Awin
  • CJ
  • Cuelinks
  • Impact Radius
  • INRDeals
  • Linkwise
  • Demo
  • Advertiser pages
    • Advertisers
    • Cashback shop pages
    • Default and custom cashback value
    • Coupons auto-import
  • Shortcodes
    • Advertisers/Shop list
    • Tracking links
    • Advertiser info
    • Coupons
  • Widgets
    • How to add widgets
  • User registrations
    • User registrations
    • Go to shop button
  • myCRED plugin integration
    • Introduction
    • Installation & setup
    • Visualization for users
    • Point management
  • Integrations
    • Content Egg integration
    • Affiliate Egg integration
    • WooCommerce integration
  • Troubleshooting & FAQ
    • Logs
    • Orders
    • FAQ
  • How to...
    • How to unify Tracking ID prefix
    • How to redeem points for money
    • How to change points to real products
    • How to change Go to shop button color
    • How to give commission to author of post
  • For developers
    • Cashback events
    • Cashback shop custom template
    • Shortcode templates
    • Compatible themes
Powered by GitBook
On this page

Was this helpful?

  1. For developers

Cashback events

Cashback Tracker - is plugin for tracking and statistic. Maybe you want to extend it's functions. For this, we added several hooks

You must have code skills for PHP and WordPress to understand this part of documentation.

Order hooks

Cashback Tracker has three events which you can use for custom functions

cbtrkr_order_create

new order was added with pending status

cbtrkr_order_approve

order got approved status

cbtrkr_order_decline

order got declined status

Example of hook:

add_action('cbtrkr_order_create', 'myOrderCreate');

function myOrderCreate($order)
{
    //print_r($order);
}

Variable will have array with next data:

array
(
    'id' => '177'
    'user_id' => '1'
    'order_id' => '1556116749647'
    'module_id' => 'Demo'
    'create_date' => '2019-04-24 14:39:09'
    'order_status' => '0'
    'completion_date' => null
    'advertiser_id' => '123'
    'advertiser_domain' => 'example.com'
    'currency_code' => 'USD'
    'sale_amount' => '590.00'
    'commission_amount' => '29.50'
    'subid' => 'cbtrkr-1'
    'click_date' => '2019-04-04 04:59:14'
    'action_date' => '2019-04-20 07:55:01'
    'user_referer' => ''
    'api_response' => ''
    'merchant_order_id' => '1556116749647'
)

Example of code to calculate cashback and currency:

list($amount, $currency) = \CashbackTracker\application\components\Commission::calculateCashback($order);
PreviousHow to give commission to author of postNextCashback shop custom template

Last updated 5 years ago

Was this helpful?