Skip to content

Instantly share code, notes, and snippets.

@hirejordansmith

hirejordansmith/functions.php Secret

Last active Oct 2, 2019
Embed
What would you like to do?
How to add additional content below the Single Product Short Description in Woocommerce
<?php
/**
* How to add text or other content below the Single Product Short Description in Woocommerce
*
* @author Jordan Smith <jordan@hirejordansmith.com>
* @link https://hirejordansmith.com
*/
// Basic Use Case
add_action( 'woocommerce_single_product_summary', 'hjs_below_single_product_summary', 20 );
function hjs_below_single_product_summary() {
// Add Your Additional Content Here
}
// Real World Example using ACF to integrate a dynamic YouTube video id via custom field
add_action( 'woocommerce_single_product_summary', 'hjs_video_below_single_product_summary', 20 );
function hjs_video_below_single_product_summary() {
$video_id = get_field('product_video_id'); ?>
<div class="product-video">
<a class="popup-youtube button" href="http://www.youtube.com/watch?v=<?php echo $video_id; ?>&amp;rel=0&amp;controls=0&amp;showinfo=0">Watch Video</a>
</div>
<?php }
// Real World Example adding a shortcode below the Single Product Short Description
add_action( 'woocommerce_single_product_summary', 'hjs_shortcode_below_single_product_summary', 20 );
function hjs_shortcode_below_single_product_summary() {
echo do_shortcode('[your_shortcode]');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.