Answer the question
In order to leave comments, you need to log in
How to change the style of the "in the cart" button?
Hello, how can I change the style of the "add to cart" button in woocommerce (for example, change the color) for a product that is already in the cart? I know that there is a hook for changing the text of a button, but is there a hook for editing a tag or its styles, or something like that? The theme is storefront.
Answer the question
In order to leave comments, you need to log in
hook to change the text on the button, jsom search for this text and add style to the element
add_filter( 'add_to_cart_text', 'woo_custom_product_add_to_cart_text' ); // < 2.1
add_filter( 'woocommerce_product_add_to_cart_text', 'woo_custom_product_add_to_cart_text' ); // 2.1 +
function woo_custom_product_add_to_cart_text() {
return __( 'My Button Text', 'woocommerce' );
}
setInterval(function(){
$('a:contains("My Button Text")').css('border', '1px solid red');
},1000);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question