Skip to content

Instantly share code, notes, and snippets.

@hirejordansmith
Last active October 2, 2019 18:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hirejordansmith/314a79818a4e89ea88497cf17d57e2f6 to your computer and use it in GitHub Desktop.
Save hirejordansmith/314a79818a4e89ea88497cf17d57e2f6 to your computer and use it in GitHub Desktop.
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