Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • @mattmikulla
    Thank you ever so much!

    @travellers
    I didn’t completely understand Mattmikulla by reading. I suggest trying what you can, it got the point across for me.

    Here is a simplified, I hope, explanation.

    You found single-product.php because the name of that file seems like the most likely place to find the template. Once inside single-product.php you find it really is just referencing content-single-product.php.

    You get into content-single-product.php and see the following hooks.

    <?php
    			/**
    			 * woocommerce_single_product_summary hook
    			 *
    			 * @hooked woocommerce_template_single_title - 5
    			 * @hooked woocommerce_template_single_price - 10
    		 	 * @hooked woocommerce_template_single_add_to_cart - 15
    			 * @hooked woocommerce_template_single_excerpt - 20
    			 * @hooked woocommerce_template_single_meta - 40
    			 * @hooked woocommerce_template_single_sharing - 50
    			 */
    			do_action( 'woocommerce_single_product_summary' );
    		?>

    Imagine each @ hooked as a tag (h1, h2, p, a) on the site. The @ hooked title is probably your h1 and the single_price @ hooked is probably the price. All of the @ hook elements are contained within the hook (similar to a div surrounding elements inside it) called * woocommerce_single_product_summary hook. What Mattmikulla showed you was how to move the @ hooks (think tags) from one hook (think divs) to another (think different div).

    For your particular needs all you may need is to change the order of the hook elements. That works by changing the ordering number to the right in a similar manner to what Mattmikulla just showed. I followed his method but used slightly modified php to move my payment button up just under the cost.

    <?php
    /*---Move Single Page Product Buy Button*/
    remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
    add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 15 );
    ?>

    Hope that helps.

    Fixed. Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)