Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NiklasHogefjord/7ce355bb50c156ddfab4356751b40033 to your computer and use it in GitHub Desktop.
Save NiklasHogefjord/7ce355bb50c156ddfab4356751b40033 to your computer and use it in GitHub Desktop.
Add WooCommerce customer note to publishedComment in order data sent to Specter
<?php
/**
* Filter hook wc_specter_published_comment
* Modify publishedComment sent to Specter on new order submission.
* publishedComment is displayed on the order/packing slip that can be sent to the customer.
*
**/
add_filter( 'wc_specter_published_comment', 'my_wc_specter_published_comment', 10, 2 );
function my_wc_specter_published_comment( $published_comment, $order ) {
// Remember that $published_comment contains info about coupon codes if used in the order.
// Let's add the customer note to $published_comment so the possible coupon code info don't get overwritten.
$published_comment .= wptexturize( $order->customer_note );
return $published_comment;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment