Home Wordpress/Woocommerce - Edit template after product content but before related products
Reply: 0

Wordpress/Woocommerce - Edit template after product content but before related products

user5656 Published in September 19, 2018, 7:13 pm

Im wanting to edit the woocommerce product template to allow me to add some code (a banner) just after my main product description but before the related products.

The code Im editing(within /wp-content/plugins/woocommerce/templates/single-product.php);

     * woocommerce_before_main_content hook.
     * @hooked woocommerce_output_content_wrapper - 10 (outputs opening divs for the content)
     * @hooked woocommerce_breadcrumb - 20
    do_action( 'woocommerce_before_main_content' );

    <?php while ( have_posts() ) : the_post(); ?>

        <?php wc_get_template_part( 'content', 'single-product' ); 

                          /*My code start*/
        echo "<div class=\"product-footer\">";
        echo "<h1 class=\"product-footer-text\">Need some additional help? Or have an enquiry?</h1>";
        echo "<h5 class=\"product-footer-text\"><i class=\"fa fa-phone\"></i>  Call one of our sales team on <strong>01782</strong></h5>";
        echo "<h5 class=\"product-footer-text\" style=\"margin-top: -40px;\"><i class=\"fa fa-envelope\"></i>  Contact us via our contact page <strong><a style=\"color: #ffffff;\" href=\"/../contact\" target=\"_blank\">HERE</a></strong></h5>";
        echo "<p class=\"product-footer-text\"><i><strong>Order note: </strong>All prices above are subject to delivery charges and VAT where applicable </i></span></p>
                            /*My code end*/

    ?><?php endwhile; // end of the loop. ?>

     * woocommerce_after_main_content hook.
     * @hooked woocommerce_output_content_wrapper_end - 10 (outputs closing divs for the content)
    do_action( 'woocommerce_after_main_content' );

     * woocommerce_sidebar hook.
     * @hooked woocommerce_get_sidebar - 10
    do_action( 'woocommerce_sidebar' );

Is giving me these results; https://i.stack.imgur.com/sTgY6.png

I wanting the the banner at the bottom to appear below the product desc. Ive been messing around with the code for quite awhile now and just cant seem to get it working.

share|improve this question

1 Answer 1

active oldest votes
up vote 1 down vote accepted
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.34182 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO