QR Code

0.0/5
<?php
add_action('woocommerce_thankyou_bacs', 'wpd_qr_code', 10, 1 );
function wpd_qr_code( $order_id ) {
    
    $order = wc_get_order( $order_id );
		
    $bacs_info  = get_option( 'woocommerce_bacs_accounts');
	
	echo "<div style='display: grid; grid-template-columns: auto auto auto;'>";
	
	foreach ($bacs_info as $info ) {
    $account = explode( "/", $info['account_number']) ? explode( "/", $bacs_info[0]['account_number']) : null ;
	
    if (! $account) {
	 return;
	}
	
	$currency	= $info['account_name'];
	$bank_name 	= $info['bank_name'];
	
		
	$account_number 	= $account[0] ;
	$bank_code 			= $account[1];
	$amount 			= $order->get_total();
	$variable_symbol 	= $order->get_id();
	$message 			= get_bloginfo('name');
	

    echo '<div style="margin-bottom: 30px;">';
	echo '<h3>';
	echo $currency;
	echo '</h3>';
	echo '<h4>';
	echo $account_number;
	echo '</h4>';
	echo '<h5>';
	echo $bank_name;
	echo '</h5>';
	echo '<img src="//api.paylibo.com/paylibo/generator/czech/image?accountNumber=' . $account_number 
		. '&bankCode=' . '0800'
		. '&amount=' . $amount 
		. '&currency=' . 'CZK'
		. '&vs=' . $variable_symbol  
		. '&message=' . $message . '" />';
    echo '</div>';

	}
	echo '</div>';
}

add_action( 'woocommerce_email_after_order_table', 'wpd_qr_email', 15 );
  
function wpd_qr_email( $order ) {

    if ($order->get_payment_method() != 'bacs') {	
		return;	
    }
    
    $bacs_info  = get_option( 'woocommerce_bacs_accounts');
	
    $account = explode( "/", $bacs_info[0]['account_number']) ? explode( "/", $bacs_info[0]['account_number']) : null ;
	
    if (! $account) {
	 return;
	}
	echo "<div style='display: grid; grid-template-columns: auto auto auto;'>";
	
	foreach ($bacs_info as $info ) {
    $account = explode( "/", $info['account_number']) ? explode( "/", $bacs_info[0]['account_number']) : null ;
	
    if (! $account) {
	 return;
	}
	
	$currency	= $info['account_name'];
	$bank_name 	= $info['bank_name'];
	
		
	$account_number 	= $account[0] ;
	$bank_code 			= $account[1];
	$amount 			= $order->get_total();
	$variable_symbol 	= $order->get_id();
	$message 			= get_bloginfo('name');
	

    echo '<div style="margin-bottom: 30px;">';
	echo '<h3>';
	echo $currency;
	echo '</h3>';
	echo '<h4>';
	echo $account_number;
	echo '</h4>';
	echo '<h5>';
	echo $bank_name;
	echo '</h5>';
	echo '<img src="//api.paylibo.com/paylibo/generator/czech/image?accountNumber=' . $account_number 
		. '&bankCode=' . '0800' 
		. '&amount=' . $amount 
		. '&currency=' . 'CZK'
		. '&vs=' . $variable_symbol  
		. '&message=' . $message . '" />';
    echo '</div>';

	}
	echo '</div>';
   
}

Comments and reviews

{{ reviewsTotal }} Review
{{ reviewsTotal }} Reviews
{{ options.labels.newReviewButton }}
{{ userData.canReview.message }}

Description

This snippet was fetched automatically from WPDistro.cz projects.

Author

Tags

This snippet is untagged