WordPress Codesnippets

woocommerce_email_attachments get order id

				
					
				
			

This code adds a filter to the WooCommerce email attachments, to attach the post field ID when the ‘customer_completed_order’ email is sent. It checks if the email type is ‘customer_completed_order’, if so, it attaches the post field ID and then returns the attachments. This code ensures that customers receive the post field ID when they complete an order.

Was this code snippet helpful?
YesNo

Leave a Reply

Your email address will not be published. Required fields are marked *

Programmatically save post

This code creates a WordPress post with the values of the ‘post_title’ and ‘post_content’ variables. It sets the post status to ‘publish’ and the author

Read More »

Create order programmatically

This code creates a new post in the WordPress database with post type ‘shop_order’, post title ‘Order #12345’, post status ‘wc-processing’, and ping status ‘closed’.

Read More »