• Hello.
    This is the default anchor tag associated to QR code image:
    a href=”//{{{BITCOINS_ADDRESS}}}?amount={{{BITCOINS_AMOUNT}}}”

    Browser uses an http/https uri scheme by default, so by clicking on it it calls http(s)://{{{BITCOINS_ADDRESS}}}?amount={{{BITCOINS_AMOUNT}}}

    Obviously wrong. Bitcoin URI is the right way to manage this hyperlink.
    So in the woocomerce preference – bitcoin checkout tag – Payment Instructions (HTML), I changed the anchor tag like this:

    a href=”bitcoins:{{{BITCOINS_ADDRESS}}}?amount={{{BITCOINS_AMOUNT}}}”

    Click save changes.
    Surprise surprise! The bitcoin: doesn’t get saved and the result is:

    a href=”{{{BITCOINS_ADDRESS}}}?amount={{{BITCOINS_AMOUNT}}}”

    Damn!
    So, is it a bug? An intended behaviour? Am I missing something?
    I would like to let my customers click on the QR code and have all the payment informations in their btc wallet ready to be processed.

    Thanks
    Luca.

Viewing 1 replies (of 1 total)
  • Hi!
    I was experiencing the same problem, in addition to the QR image itself being generated from a bad link. So neither worked.

    The problem is the following:
    1- Default template for payment instructions is wrong.
    2- WordPress escapes protocols that are not whitelisted, including “bitcoin:”, from anchor tags and other strings. This is an intended behavior (by WordPress).

    I hope to get a little time to open another ticket properly addressing the issue and ideally helping the devs fix it quickly and easily.
    This plugin appears to be growing in popularity, and it is a real gift from the developers.
    I see a lot of support tickets being filed. I hope they are receiving tips(donations) accordingly. It is due.

    That being said:

    THE FIX:
    STEP – 1 :
    Add this code to your theme’s functions file (functions.php):

    function wporg_extend_allowed_protocols( $protocols ){
        $protocols[] = 'bitcoin';
        return $protocols;
    }
    add_filter( 'kses_allowed_protocols' , 'wporg_extend_allowed_protocols' );

    This will whitelist “bitcoin” as a protocol and will stop the undesired escaping.

    STEP – 2
    In the Payment Instructions field, replace the QR anchor tag with the following:

    <a href="bitcoin:{{{BITCOINS_ADDRESS}}}?amount={{{BITCOINS_AMOUNT}}}"><img src="https://blockchain.info/qr?data=bitcoin:{{{BITCOINS_ADDRESS}}}?amount={{{BITCOINS_AMOUNT}}}&size=180" style="vertical-align:middle;border:1px solid #888" /></a>

    That’s replacing the “//” for “bitcoin:” in the href parameter
    &
    replacing “bitcoin://” for “bitcoin:” in the QR generating link.

    I hope this works fine for you or anyone encountering the same or similar issue.

    • This reply was modified 8 years, 6 months ago by panimarcus.
    • This reply was modified 8 years, 6 months ago by panimarcus. Reason: because I wrote it wrong
Viewing 1 replies (of 1 total)
  • The topic ‘Bitcoin URI wrong and not modifiable’ is closed to new replies.