Feature Request – Purchase Note or Hidden Note
-
AuthorPosts
-
ALiuzer 1 month, 1 week ago
HI Ihor,
Is there a way to add a Purchase Note or Hidden Note to the listings?
The use case is to reveal additional info for the listing AFTER someone has already made a purchase.Thanks,
AllenPlease add a new Textarea attribute in Listings/Attributes section and name it “Hidden note”, also enable the front-end editing for it. Then if you add this code snippet (via the Code Snippets plugin or to the child theme’s functions.php file) sellers will be able to set a hidden note for each listing, it will be displayed to buyers only when the order is paid (at the bottom of the order page):
add_filter( 'hivepress/v1/templates/order_footer_block', function( $template ) { $order = wc_get_order( get_query_var( 'view-order' ) ); if ( $order && in_array( $order->get_status(), [ 'processing', 'completed' ], true ) ) { $item = hivepress()->helper->get_first_array_value( $order->get_items() ); if ( $item && $item->get_product_id() ) { $product = wc_get_product( $item->get_product_id() ); if ( $product ) { $listing = \HivePress\Models\Listing::query()->get_by_id( $product->get_parent_id() ); if ( $listing ) { $template = hivepress()->helper->merge_arrays( $template, [ 'blocks' => [ 'hidden_note' => [ 'type' => 'content', 'content' => '<div class="hp-hidden-note">' . $listing->display_hidden_note() . '</div><br>', '_order' => 5, ], ], ] ); } } } } return $template; } );
-
AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.