Created
July 3, 2020 14:23
-
-
Save EricBusch/1fb57b17ac204289ca7b9b6436bd73de to your computer and use it in GitHub Desktop.
Add the WooCommerce product ID as the Tracking ID in the affiliate URL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function mycode_add_product_id_as_tracking_id( $tracking_id, $product ) { | |
return wc_get_product_id_by_sku( $product['_id'] ); | |
} | |
add_filter( 'dfrapi_tracking_id', 'mycode_add_product_id_as_tracking_id', 20, 2 ); |
Hi
Please remove the leading <?php
code when you paste the code into your custom plugin.
Hope this helps!
Eric
Thanks for your answer here as well. I'll reply in our email thread as well.
Best,
Kasper
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Eric,
My product set breaks when I add this code to a custom WP plugin. It just stops showing products.
Any idea what to do? Is it still up to date with this code?
Best,
Kasper