Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # reduce stock filter
- function stock_change_email_log( $order ) {
- $email = 'youemail@domain';
- $subject = 'Stock is changed - Log';
- $product_details = array('<h4>Product changed details:</h4>');
- $order_items = $order->get_items();
- foreach( $order_items as $product ) {
- $product_details[] = 'UN: ' . $product['qty'] . ' | (' . $product['product_id'] . ') ' . $product['name'];
- }
- $product_list = implode( '<br>', $product_details );
- wp_mail($email, $subject, $product_list);
- }
- add_action( 'woocommerce_reduce_order_stock', 'stock_change_email_log' );
- # enable html content
- function email_log_content_type(){
- return "text/html";
- }
- add_filter( 'wp_mail_content_type','email_log_content_type' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement