开发者 | thedoctorcoernel |
---|---|
更新时间 | 2022年10月9日 15:32 |
PHP版本: | 7.0 及以上 |
WordPress版本: | 6.0.2 |
版权: | GPLv2 or later |
版权网址: | 版权信息 |
/wp-content/themes/Your(Child)Theme/functions.php
php
/* QR-Code in invoices */
add_action( 'wpo_wcpdf_after_order_details', 'wpo_wcpdf_qr_code', 10, 2 );
function wpo_wcpdf_qr_code ($document_type, $order) {
require_once WP_PLUGIN_DIR . '/mxp-sepaqr/muxp-sepaqr.php';
$muxp_order = wc_get_order( $order);
$order_id = $order->get_id();
if ( !empty($muxp_order->get_total()) && (float)$order->get_total() > 0 ) {
echo '<img class="bcas-qrcode" src="' . muxp_get_qrcode($order->get_total(), $order_id) . '" alt="qr-code"></p>';
}
}
Configuration / translation / if it does not work
The plugin comes with a little fallback: In case the BIC, IBAN, etc. are not shown open the mxp-sepaqr.php in the programing code you can hardcode some variables and translations. You'll find explanations in the comments.
Advanced configuration of the qr-code itself
Have a look at fellwell15
Testing and troubleshooting
Simple way
Install the plugin and order s.th. in your shop using BACS (direct bank transfer).
To test if the QR-Code generator is working
www.yourwebpage.de/?mxp_qr=something = creates a real QR with dummyvalues 11-11
Working example
To find an existing cached QR-Code, query for a valid md5 string. If it does not exist in cache or transients, a sad smiley will appear.
www.yourwebpage.de/?mxp_qr=351436ef4b279e1811a6c68a2dd58b1b
results in a sad smiley. Working example
Remarks
Storing the QR code in cache or transients is only needed if you want to use a link instead of a picture inside the email. Details in the program code.
Support
The program has been written by a professional programmer - however fully free of charge and without detailed knowledge about WooCommerce. The program comes as is and we cannot give support. I have no clue about it and the programmer can't work for free!
Full integration in Woocommerce
I am more then happy if someone integrates the code into the Woocommerce core! The topic is discussed here: https://github.com/woocommerce/woocommerce/issues/27661
This might be due to the fact that some email clients won't show Base64-encoded images. Your help is appreciated! Have a look at https://github.com/Coernel82/SEPA-QR-for-Woocommerce/issues/17
The plugin creates the QR-Code on your server and it does not use any external resources.