WooCommerce: Display Custom Content on Single Product Pages

In this post, we’ll learn how to display custom content under the “Add to Cart” button on single product pages in WooCommerce. By adding custom content, you can provide additional information or promotional messages to encourage users to make a purchase.

/**
* Snippet Name:  Display custom content under the Add to Cart button 
* Snippet Author:  wpsnippets.div
*/
 
// Display custom content under the Add to Cart button on single product pages
function wps_custom_content_under_add_to_cart() {
    ?>
    <div class="wps_custom-content">
        <!-- Your custom content goes here -->
        <p>This is custom content displayed under the Add to Cart button.</p>
    </div>
    <?php
}
add_action('woocommerce_single_product_summary', 'wps_custom_content_under_add_to_cart', 35);

Code Explanation

  • This code utilizes the woocommerce_single_product_summary hook to display custom content beneath the “Add to Cart” button on single product pages. You can customize the content inside the <div> according to your requirements.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top