WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. alexluchini
    Member
    Posted 1 year ago #

    Hello,

    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:


    <?php
    /**
    * 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??

    http://wordpress.org/extend/plugins/woocommerce/

  2. bridieamelia
    Member
    Posted 1 year 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.

    e.g.

    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
    Member
    Posted 9 months 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??

    Thanks

  4. gerygreen
    Member
    Posted 8 months 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

About this Topic