I want to add a nice and small button “add to cart” to the product displayed by WooCommerce Products Widget.

So I have copied content-widget-product.php to my child theme (based on Storefront) and tried two ways :
first : echo do_shortcode(‘[add_to_cart id=”‘.$product_id.'”]’);
and also : woocommerce_template_loop_add_to_cart();

But either way, the result is ugly : I get a huge “add to cart” button that is as wide as my page screenshot here:

I would like to get a much smaller button, aligned with the picture of the item. Something like that :
I guess I should change some CSS but I don’t know how…
Could you help me ?

Many thanks

Read more here: WooCommerce : change the style of "add to cart" button in a widget


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: