Created
April 4, 2018 13:26
-
-
Save NiklasHogefjord/7ce355bb50c156ddfab4356751b40033 to your computer and use it in GitHub Desktop.
Add WooCommerce customer note to publishedComment in order data sent to Specter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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