• Resolved awangtay

    (@awangtay)


    I am using the plugin but it does not work when I added

    <tr class="payment-method">
    					<th><?php _e( 'Payment Status:', 'woocommerce-pdf-invoices-packing-slips' ); ?></th>
    					<td><?php $this->get_status(); ?></td>
    				</tr>

    into

    		<td class="order-data">
    			<table>
    				<?php do_action( 'wpo_wcpdf_before_order_data', $this->type, $this->order ); ?>
    				<?php if ( isset($this->settings['display_number']) ) { ?>
    				<tr class="invoice-number">
    					<th><?php _e( 'Invoice Number:', 'woocommerce-pdf-invoices-packing-slips' ); ?></th>
    					<td><?php $this->invoice_number(); ?></td>
    				</tr>
    				<?php } ?>
    				<?php if ( isset($this->settings['display_date']) ) { ?>
    				<tr class="invoice-date">
    					<th><?php _e( 'Invoice Date:', 'woocommerce-pdf-invoices-packing-slips' ); ?></th>
    					<td><?php $this->invoice_date(); ?></td>
    				</tr>
    				<?php } ?>
    				<tr class="order-number">
    					<th><?php _e( 'Order Number:', 'woocommerce-pdf-invoices-packing-slips' ); ?></th>
    					<td><?php $this->order_number(); ?></td>
    				</tr>
    				<tr class="order-date">
    					<th><?php _e( 'Order Date:', 'woocommerce-pdf-invoices-packing-slips' ); ?></th>
    					<td><?php $this->order_date(); ?></td>
    				</tr>
    				<tr class="payment-method">
    					<th><?php _e( 'Payment Method:', 'woocommerce-pdf-invoices-packing-slips' ); ?></th>
    					<td><?php $this->get_payment_method(); ?></td>
    				</tr>
    				<?php do_action( 'wpo_wcpdf_after_order_data', $this->type, $this->order ); ?>
    			</table>			
    		</td>
    	</tr>

    Can somebody guide me? Thank you.

    • This topic was modified 3 years ago by awangtay.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Darren Peyou

    (@dpeyou)

    Hi @awangtay,

    I wonder if you maybe need to “echo” the statement. This code snippet displays the order status:

    add_action( 'wpo_wcpdf_after_order_data', 'wpo_wcpdf_add_status_to_pdf', 10, 2 );
    function wpo_wcpdf_add_status_to_pdf( $template_type, $order ) {
    	if ( ! empty($order) ) {
    		?>
    		<tr class="order-status">
    			<th>Order status: </th>
    			<td><?php echo $wc_get_order_status_name( $order->get_status() ); ?></td>
    		</tr>
    		<?php
    	}
    }

    order-Status

    • This reply was modified 3 years ago by Darren Peyou. Reason: improve code
    Plugin Contributor Darren Peyou

    (@dpeyou)

    @awangtay,

    There’s a typo in my previous post. Please use this instead:

    add_action( 'wpo_wcpdf_after_order_data', 'wpo_wcpdf_add_status_to_pdf', 10, 2 );
    function wpo_wcpdf_add_status_to_pdf( $template_type, $order ) {
    	if ( ! empty($order) ) {
    		?>
    		<tr class="order-status">
    			<th>Order status: </th>
    			<td><?php echo wc_get_order_status_name( $order->get_status() ); ?></td>
    		</tr>
    		<?php
    	}
    }
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to add order status in invoice pdf’ is closed to new replies.