For developers
Filter obs_linkwise_item_payout, meta _linkwise_payout_value and WordPress points where Linkwise plugin adds code.
Filter for payout#
The obs_linkwise_item_payout accepts the payout price of each line, order line and product. Example for payout 2 in a category:
add_filter('obs_linkwise_item_payout', function ($payout, $item, $product) { if ($product && has_term('therapeies', 'product_cat', $product->get_parent_id() ?: $product->get_id())) { return '2'; } return $payout; }, 10, 3);
The value you return is sent as it is, so you return number in text format with dot.
Product Meta#
_linkwise_payout_value: Payout price in product or variant. If missing from variant, read from parent.
Entry points#
| Hook | What's he doing? |
|---|---|
init | Writes or deletes cookie linkwise. |
wp_head | Loads the tl.js with setProgram and setDecimal. |
woocommerce_thankyou | Prints the completion code for the order. |
woocommerce_integrations | Integration Registers linkwise_affiliate. |
Settings at Foundation#
Settings are stored as WooCommerce input settings (lw_program_id, lw_decimal_separator, lw_posts_per_page, lw_default_vat_rate). The plugin states compatibility with HPOS and reads orders with wc_get_order().
Tests#
ZIP contains light tests (php tests/run-linkwise-tests.php) for VAT, decimals, payout and attribution.
Send a request; the plugin and the article are automatically completed.