• Resolved Vic

    (@itutorua)


    Hi,
    Thanks for a great plugin!

    I have an issue with the link generator. When I insert a direct add to cart link (https://site.name/?add-to-cart=14933) the output URL has & instead of the ampersand (&), so it looks like this:
    https://site.name/?add-to-cart=14933&ref=3643
    When users follow the link the website doesn’t recognize it as an affiliate link thus such orders are not visible in the Affiliates Dashboard and they don’t earn any commission.

    Any ideas on how this can be fixed?

    Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Juan Coronel

    (@juaancmendez)

    Hello there,
    we hope you’re doing well!

    In order to fix that, pelase try adding the following code inside the functions.php file of your active child theme:

    if ( ! function_exists( 'yith_wcaf_fix_generated_link' ) ) {

    function yith_wcaf_fix_generated_link( $generated_link ) {

    $generated_link = str_replace( "#038;", "&", $generated_link );

    return $generated_link;

    }

    add_filter( 'yith_wcaf_link_generator_generated_url', 'yith_wcaf_fix_generated_link', 10, 1 );

    }

    Try it out and let us know any news.

    Have a good day!

    Thread Starter Vic

    (@itutorua)

    Hi Juan,
    Thanks for the follow up! This almost fixed the issue, the only problem is that now it adds two ampersands, so the generated link looks like that:
    https://site.name/?add-to-cart=14933&&ref=3643

    Thread Starter Vic

    (@itutorua)

    I’ve updated the code (added & before #038;) so now it’s working fine.

    if ( ! function_exists( 'yith_wcaf_fix_generated_link' ) ) {
    function yith_wcaf_fix_generated_link( $generated_link ) {
    $generated_link = str_replace( "&", "&", $generated_link );
    return $generated_link;
    }
    add_filter( 'yith_wcaf_link_generator_generated_url', 'yith_wcaf_fix_generated_link', 10, 1 );
    }

    Please LMK if that’s correct or if there are any downsides with that.

    Plugin Support Juan Coronel

    (@juaancmendez)

    Hello there,

    The code you have modified is correct and you should have no problems with it.

    If I can do anything else for you, please let me know. Meanwhile I’ll mark this topic as resolved.

    Best regards.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.