Hi @johnson0118,
The correct way to call the get_sku()
is to call it on a WC product object.
So, something like the below would work:
$_product = wc_get_product( $items->get_product_id() );
$sku = $_product->get_sku();
Please accept my apologies for the delay in response. In case if you have any further queries, please feel free to get in touch.
Thanks,
Pinal
-
This reply was modified 3 years, 5 months ago by Pinal Shah.
@pinalshah Thank you for your response. I recently found a method to add sku to quote Email. Add below code to foreach loop and <tr> tag, it works well.
// add sku to foreach loop
$product_id = $items->get_product_id();
$_product = wc_get_product( $product_id );
$sku = $_product->get_sku();
// add sku end
<!– add sku to <tr> tag –>
<td style=”text-align:left; border: 1px solid #eee;”><?php echo wp_kses_post( $sku ); ?></td>
<!– add sku end –>
Thanks,
Johnson
-
This reply was modified 3 years, 5 months ago by johnson0118.
-
This reply was modified 3 years, 5 months ago by johnson0118.
-
This reply was modified 3 years, 5 months ago by johnson0118.
Hi Johnson,
I’m glad to know you were able to get this to work as desired. It would help me immensely if you would be so kind as to consider leaving a review for the plugin here.
Thanks in advance,
Pinal