• Resolved gossie

    (@gossie)


    Hi team

    A few weeks ago you helped me in adding the SKU field to the invoice pdf. Thx for that ?? Now we have had our first real auctions and we will have to adapt our working methods to the remarks of our management board. Could you please help me in deleting this SKU again? I use the following code in the invoice-details.php. THANK YOU !

    <?php global $ywpi_document; ?>
    
    <table class="invoice-details">
    	<thead>
    	<tr>
    		<th class="column-product"><?php _e ( 'Product', 'yith-woocommerce-pdf-invoice' ); ?></th>
    		<th class="column-quantity"><?php _e ( 'Qty', 'yith-woocommerce-pdf-invoice' ); ?></th>
    	</tr>
    	</thead>
    	<tbody>
    	<?php
    
    	$order_items = $ywpi_document->order->get_items ();
    	foreach ( $order_items as $item_id => $item ) {
    		if ( isset( $item['qty'] ) ) {
    			$price_per_unit      = $item["line_subtotal"] / $item['qty'];
    			$price_per_unit_sale = $item["line_total"] / $item['qty'];
    			$discount            = $price_per_unit - $price_per_unit_sale;
    		}
    		$tax = $item["line_tax"];
    $product = wc_get_product( $item['product_id'] );
    
    		?>
    		<tr>
    			<td class="column-product"><?php echo $item['name']; ?>
    				<br>
    				<?php echo "SKU: " . $product->get_sku(); ?>
    			</td>
    			<td class="column-quantity"><?php echo ( isset( $item['qty'] ) ) ? esc_html ( $item['qty'] ) : ''; ?></td>
    		</tr>
    
    	<?php };
    
    	foreach ( $order_shipping as $item_id => $item ) {
    		if ( isset( $item['cost'] ) ) {
    			$total_shipping += $item['cost'];
    		}
    
    		?>
    
    		<tr>
    			<td class="column-product">
    				<?php echo ! empty( $item['name'] ) ? esc_html ( $item['name'] ) : __ ( 'Shipping', 'yith-woocommerce-pdf-invoice' ); ?>
    			</td>
    
    			<td class="column-quantity">
    			</td>
    		</tr>
    		<?php
    	};
    
    	foreach ( $order_fees as $item_id => $item ) {
    		if ( isset( $item['line_total'] ) ) {
    			$total_fee += $item['line_total'];
    		}
    		if ( isset( $item['line_tax'] ) ) {
    			$total_fee_tax += $item['line_tax'];
    		}
    		?>
    
    		<tr>
    			<td class="column-product">
    				<?php echo ! empty( $item['name'] ) ? esc_html ( $item['name'] ) : __ ( 'Fee', 'yith-woocommerce-pdf-invoice' ); ?>
    			</td>
    
    			<td class="column-quantity">
    			</td>
    
    		</tr>
    		<?php
    	};
    	?>
    
    	</tbody>
    </table>
    
    <table>
    	<tr>
    		<td class="column1">
    
    		</td>
    		<td class="column2">
    		</td>
    	</tr>
    
    </table>

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author YITHEMES

    (@yithemes)

    Hello there,
    hope you are doing well! ??

    To remove the SKU, you only need to remove the next two lines from your code:

    <br>
    <?php echo "SKU: " . $product->get_sku(); ?>

    They are in line 25 and 26 of your code.

    Could you check it and let us know, please?

    Have a nice day!

    Thread Starter gossie

    (@gossie)

    Hi, thank you for this code, I will let you know asap ??

    Thread Starter gossie

    (@gossie)

    tested and found ok !

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘delete SKU from invoice plugin’ is closed to new replies.