• Resolved Jake Jackson

    (@blue-liquid-designs)


    Hi,

    I’m running into a problem with the ‘print’ button on the front-end order received page (/checkout/order-received/332/?key=wc_order_5361bc618b93d) when using guest checkout. In my testing, clicking the print button after making a purchase produced a blank white screen. But I had no trouble printing if I checked out as a logged in user.

    Do you have any suggestions to allow guests to print their order after payment?

    https://wordpress.org/plugins/woocommerce-delivery-notes/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Jake Jackson

    (@blue-liquid-designs)

    For those of you after a solution to this issue, I’ve rewritten the create_print_button_order_page function in /includes/class-wcdn-theme.php.

    /**
    		 * Create a print button for the 'View Order' page
    		 */
    		public function create_print_button_order_page( $order_id ) {
    			if( get_option( WooCommerce_Delivery_Notes::$plugin_prefix . 'print_button_on_view_order_page' ) ) {
    
    				$print_url = '';
    				/*
    				 * Get the order details and check if we have an order key
    				 */
    				if(isset($_GET['key']))
    				{
    					$order_key 	= $_GET['key'];
    					$order 		= new WC_Order( $order_id );			
    
    					/*
    					 * Check if our order key matches what is on file
    					 */
    					if($order->order_key == $order_key)
    					{
    						$email = $order->billing_email;
    						$print_url = wcdn_get_print_link( $order_id, $this->template_type, $email );
    					}
    
    				}
    				else
    				{
    					$print_url = wcdn_get_print_link( $order_id, $this->template_type );
    				}
    
    				if(strlen($print_url) > 0): ?>
    					<p class="order-print">
    						<a href="<?php echo $print_url; ?>" class="button print"><?php _e( 'Print', 'woocommerce-delivery-notes' ); ?></a>
    					</p>
    				<?php
    				endif;
    			}
    		}

    fixed in 3.2

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Guest Checkout 'Print' feature doesn't work’ is closed to new replies.