Changing order of elements in product page

This topic has 4 replies, 3 voices, and was last updated 7 years, 6 months ago ago by Max Mullins

  • Avatar: hidrofugo
    hidrofugo
    Participant
    May 22, 2017 at 15:03

    Hello,
    We would like to know what files we have to review to modify order what product description and purchasing button are shown.
    Currently: Product description + Add to cart button
    Desired: Add to cart button + prodduct description

    Thanks in adcance

    3 Answers
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    May 22, 2017 at 15:41

    Hello,

    You need edit the file wp-content/themes/woopress/woocommerce/content-single-product.php.
    Make your changes in the child theme to prevent losing them after theme update.

    Regards,
    Rose Tyler.

    Avatar: hidrofugo
    hidrofugo
    Participant
    May 22, 2017 at 16:08

    Hi,
    I’ve already tryed your solution, but nothing happened.
    I just found other solution, editing the functions.php file adding the following code:
    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 );

    is that right?

    Avatar: maxmullins
    Max Mullins
    Participant
    May 23, 2017 at 10:15

    Hello @hidrofugo.
    The solution is right. Just would like to add, that vodifications can be done in content-single-product.php from line 117 to 130

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

    Then you may copy woocommerce/content-single-product.php to wp-content/child-theme woocommerce/content-single-product.php. This is the best way to edit template files. However according to woocommerce documentation you may edit tempate files wit snippets and hooks in functions.php too.
    Wish you success in further development.

    Regards,
    Max Mullins

  • Viewing 4 results - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.Log in/Sign up

8theme customization service
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.