How to add Author Name in the Product Page
-
Hi Team,
I am creating a book store, I want to add Author name just under the book name. How can I achive it ?
Sample Image attached.
Attachments:
You must be
logged in to view attached files.
attached few more screenshots for reference.
Attachments:
You must be
logged in to view attached files.
Hello,
Sorry, but there is no option available for that in Theme Settings.
It requires customizations and this is beyond our limitations and support policy.
Regards.
Xtemos Studios
okay. Thanks.
I have done it, if you want to know how I did it, let me know.
Thanks
Abhisar
Hello,
Yes, please explain the solution here so in future if any one required this same feature, it will help full.
Best Regards.
Step 1: Create a Custom Field using “Add New Custom Field” in Single Product Page named as “AuthorName” and give its value. (Screenshot Attached.)
Step 2: Add the following code in fucntion.php File
// Display custom field on the single product page
function display_custom_product_field() {
global $post;
$custom_field_value = get_post_meta( $post->ID, 'AuthorName', true );
if ( ! empty( $custom_field_value ) ) {
echo '<div class="custom-product-field" style="margin-top: -15px;"><strong>Author: </strong>' . esc_html( $custom_field_value ) . '</div>';
}
}
add_action( 'woocommerce_single_product_summary', 'display_custom_product_field', 5 );
——-
Output Image attached.
——-
You can close this Ticket for now.
Attachments:
You must be
logged in to view attached files.
Hello,
Thanks for sharing the solution with all of us.
I’m so happy to hear you are pleased with the Theme and Support. XTEMOS strives to deliver the best customer experience, and it makes our day to hear we have accomplished that.
We count ourselves lucky to have you as a customer. You can always reach us at any time. We are always here to help you.
Thanks for contacting us.
Have a great day.
Topic Closed.
Best Regards.
The topic ‘How to add Author Name in the Product Page’ is closed to new replies.