Skip to content

Instantly share code, notes, and snippets.

@mahdi-alavi
Created October 19, 2016 07:42
Show Gist options
  • Save mahdi-alavi/62a9b3dbfea7666d49e515fe02633a2e to your computer and use it in GitHub Desktop.
Save mahdi-alavi/62a9b3dbfea7666d49e515fe02633a2e to your computer and use it in GitHub Desktop.
Add a message to buyers in single product page
/*
* Add a message to buyers in single product page
*/
function itl_display_note_buyers() {
global $product;
$current_user = wp_get_current_user();
if ( wc_customer_bought_product( $current_user->email, $current_user->ID, $product->id ) ) {
_e( 'your message', 'text-domain' );
}
};
add_action( 'woocommerce_single_product_summary', 'itl_display_note_buyers', 29 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment