Is it possible to show the stock status as "In Stock" "Pre-Order" in new order mails?
These codes help me show the SKU in Mail, but I could not create the stock status by changing it.
/**
* Adds SKUs and product images to WooCommerce order emails
*/
function sww_add_sku_to_wc_emails( $args ) {
$args['show_sku'] = true;
return $args;
}
add_filter( 'woocommerce_email_order_items_args', 'sww_add_sku_to_wc_emails' );
2
Answers
You can show the stock status of the products via the
woocommerce_display_item_meta
hook, for more information: https://woocommerce.github.io/code-reference/files/woocommerce-includes-wc-template-functions.html#source-view.3290Here is the code for your case:
The result will be the following:
The code has been tested and works. Add it in your theme’s functions.php file.
If you want to add custom message instead of the standard "outofstock" and "instock" status, you can use:
Code should be added to function.php of your active theme. At best in the function.php of your child theme.