Coernel82 / SEPA-QR-for-Woocommerce

Plug-and-Play Plugin for Woocommerce
GNU General Public License v2.0
4 stars 9 forks source link

Html code to include stored QR code from system #13

Closed vortexfoto closed 2 years ago

vortexfoto commented 2 years ago

Could you please give info on what code to insert to html to display QR code in other programs / plugins like PDF invoices

thanks

Coernel82 commented 2 years ago

I would love to have this function as well. As for my part a professional programmer created the first bit - the plugin itself. Which plugin are you using for PDF-invoices? Maybe you can contact your plugin provider. As this plugin is free and I am not a programmer I cannot give any assistance on this – as said before would love to have this functionality as well.

uhlhosting commented 2 years ago

Any chance we can get in touch with the original programmer who made the base of this plugin?

Coernel82 commented 2 years ago

I can do that. I will ask him about the effort on monday as I will see him then.

Coernel82 commented 2 years ago

He is on holiday now however will have a look at it after his holidays.

Coernel82 commented 2 years ago

also have a look at https://github.com/Coernel82/SEPA-QR-for-Woocommerce/issues/10

Coernel82 commented 2 years ago

After a bit of research i figured it out myself. What you need is the hook of your other plugin which creates the pdfs, for instance this:


/* QR-Code in Rechnungen */
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/mxp-sepaqr.php';
    $mxp_order = wc_get_order( $order);
    $order_id  = $order->get_id();
    if ( !empty($mxp_order->get_total()) && (float)$order->get_total() > 0 ) {
        echo '<img class="bcas-qrcode" src="' . mxp_get_qrcode($order->get_total(), $order_id) . '" alt="qr-code"></p>';
    } 
}