Leander Manuel Leander Manuel - 1 month ago 12
PHP Question

adding icon beside woocomerce add to card button

I'm new on coding, so I'm using wordpress and woocomerce for my shop please check the image below, that's my plan. But can you please teach me the right way for it?

How can I put the image before the add to cart text?

how can i put image before the add to cart text

.prod_cart a.button.product_type_simple.add_to_cart_button.ajax_add_to_cart {
text-align: center;
margin-top: 20px;
border: 1px solid #000;
border-radius: 5px;
font-size: 15px;
background-color: transparent;
background: url('../img/1.png') no-repeat;

}

Answer

You should add display:block or display:inline-block and change background to background:url('../img/1.png') no-repeat left 10px center transparent

left 10px will position image 10px from left side of button. Also you should set some paddings to your button or set width and height.