最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

Move add to cart in Woocommerce

matteradmin10PV0评论

I would like to have "add to cart" button nearby the price like in the picture.

By default, the button is placed after the price in the code, and I would like to move the button in the same tag of the price.

But I don't know which template of Woocommerce I have to edit to make this.

Thank's !

I would like to have "add to cart" button nearby the price like in the picture.

By default, the button is placed after the price in the code, and I would like to move the button in the same tag of the price.

But I don't know which template of Woocommerce I have to edit to make this.

Thank's !

Share Improve this question asked Mar 28, 2019 at 10:06 user10533272user10533272 334 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 2

You can change the priority/order by removing and re-adding the parts you want the position changed - like this:

remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
add_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_add_to_cart', 10 );

Drop this piece of code into your functions.php to take effect.

Articles related to this article

Post a comment

comment list (0)

  1. No comments so far