• My client would like to add a second ordering area (i.e. add-to-cart button) below the description and related products, on the single product page, but I’m not sure how to do it.

    I see in woocommerce/templates/single-product/ the page is split into multiple sections (I don’t know PHP, so I’m sure this makes sense, just not to me).

    How would I get the title, image, short description, price, rating, add-to-cart button, and the product variation dropdowns to also appear on the bottom of the page, as well as the top?
    Will the process be different for variable products and simple products?

    Thanks in advance!

    https://www.ads-software.com/plugins/woocommerce/

Viewing 4 replies - 1 through 4 (of 4 total)
  • I advise not altering the plugin files as changes will be overwritten by future updates.

    You can put in an add-to-cart button in the product description tab. See WooCommerce shortcodes:
    https://docs.woothemes.com/document/woocommerce-shortcodes/
    This would take the form:
    [add_to_cart id=”234″]
    Where 234 is the product id. For variable products you would need a different button for each variation.

    To put some code after the tabs, make a child theme and use an action hook in functions.php:
    https://docs.woothemes.com/document/hooks/

    add_action('woocommerce_after_single_product_summary', 'extra_code', 12);
    function extra_code() {
      $html = ''; // code to generate an add-to-cart button or whatever
      print $html;
    }

    To duplicate the title, image, short description etc is a big ask but an add-to-cart button should be do-able.

    Thread Starter criticalslinky

    (@criticalslinky)

    Hi lorro, thanks for helping me out.

    This sound good. So, I need to collect all the action hooks I want to put in this new area, and stick it in between the single quotes in $html = '';, right?

    Can I use php in this area? Or rather, is the code in that section going to be pares before it’s printed, or does it need to be html?

    You’ll only need the one action hook which is:

    add_action('woocommerce_after_single_product_summary', 'extra_code', 12);

    that should position your function output between the tabs and the related products.

    Inside the function you can use php or html to create the add-to-cart button or whatever. PHP skills will be required or you can post a job:
    https://jobs.wordpress.net/

    Thread Starter criticalslinky

    (@criticalslinky)

    Yes, hiring a developer sounds like the best plan for my limited skills. ??

    Thank you for your help! If I figure this out, I’ll post my results here.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Add Second Ordering Area to Single Product Page’ is closed to new replies.