Support » Plugin: WooCommerce Cloak Affiliate Links » Plugin Stopped Working After Update

  • Resolved witguides

    (@witguides)


    Hey Guys,

    Great plugin, been using for a long time and worked perfectly!

    After update a couple of weeks ago, cloaked links are not generating properly.

    Here are my issues:
    – Affiliate link works when pasted into browser.
    – Affiliate does not work through cloaked link in website.
    – Normal direct link works through cloaked link in website.
    – Affiliate links works through website when plugin deactivated.
    – I note the affiliate link changes when cloaked.
    – Old links work, newly generated links over past week do not.

    Website: http://www.jump-st.com.au

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author datafeedr

    (@datafeedrcom)

    Hi

    Which update are you referring to? An update to WordPress, WooCommerce or to our plugin?

    Your last comment about old links working makes me think that something changed with how WordPress or WooCommerce handle saving links…

    Thanks
    Eric

    Hi Eric,

    I can’t be certain.

    I suspect it was the last WordPress update, as I updated both around the same time.

    Cheers

    Josh

    Plugin Author datafeedr

    (@datafeedrcom)

    Hi

    It seems the issue is with how WooCommerce encodes the URL before it is saved to the database.

    Here’s the URL I entered into an External product’s Product URL field (without http://www.):

    shareasale.com/r.cfm?B=713139&U=1693&M=58539&urllink=

    And here is the value stored in the database:

    shareasale.com/r.cfm?B=713139&U=1693&M=58539&urllink=

    I added this code to a custom plugin and it fixed the issue:

    
    /**
     * Fix encoded ampersands.
     *
     * WooCommerce was saving & as &. This code
     * converts the encoded ampersands back to a regular ampersand.
     */
    add_filter( 'wccal_filter_url', 'mycode_decode_ampersand', 20, 2 );
    function mycode_decode_ampersand( $external_link, $post_id ) {
    	$external_link = html_entity_decode( $external_link, ENT_QUOTES | ENT_HTML5 );
    
    	return $external_link;
    }
    

    Here’s how to create a custom plugin: https://datafeedrapi.helpscoutdocs.com/article/32-creating-your-own-custom-plugin

    Hope this helps!

    Eric

    Plugin Author datafeedr

    (@datafeedrcom)

    Ugh! This site keeps converting my characters. I’ll post one more time adding spaces to the characters.

    Basically, WooCommerce is converting & into & # 0 3 8 ; before saving to the database.

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