Move Add-to-Cart Button in MyStile Theme (4 posts)

  1. alexluchini
    Posted 3 years ago #


    I am trying to do something that *seems* like it should be easy but I am having a hell of a time.

    I would like to move the Add-to-Cart function from the bottom of the MyStile Single Product Page to the top.

    I located the content-single-product template, at it calls this hook:

    * woocommerce_single_product_summary hook
    * @hooked woocommerce_template_single_title - 5
    * @hooked woocommerce_template_single_price - 10
    * @hooked woocommerce_template_single_excerpt - 20
    * @hooked 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' );

    I can't figure out where change the order of the individual hooks that this one hook is calling. I effectively want
    woocommerce_template_single_add_to_cart - 30
    to be called before
    woocommerce_template_single_excerpt - 20
    but I can't figure out where to make that happen.

    Can anyone help me out??


  2. bridieamelia
    Posted 3 years ago #

    Hi! Change the ALL the call numbers for the woocommerce_template_single_add_to_cart to 15. Then it will be called after the title and before the excerpt.


    add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 15 );
    	add_action( 'woocommerce_simple_add_to_cart', 'woocommerce_simple_add_to_cart', 15 );
    	add_action( 'woocommerce_grouped_add_to_cart', 'woocommerce_grouped_add_to_cart', 15 );
    	add_action( 'woocommerce_variable_add_to_cart', 'woocommerce_variable_add_to_cart', 15 );
    	add_action( 'woocommerce_external_add_to_cart', 'woocommerce_external_add_to_cart', 15 );
  3. girlapp
    Posted 2 years ago #

    This is also what I am trying to do with a site right now.

    I am trying to what bridieamelia has advised, but I've looked, ... and looked ... and looked for the woocommerce_template_single_add_to_cart , but I can't find it!

    Where is this file, if not with the other template files??


  4. Gery Green*
    Posted 2 years ago #

    Edit as @bridieamelia wrote in line 144 in woocommerce\woocommerce-hooks.php

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic