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 !

enter image description here

1 Answer 1


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.

  • Great answer, thanks! And with this visual hook guide, I can freely move where I want to.
    – Lam Le
    Commented Oct 12, 2021 at 15:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.