Change Background Color / Item in Cart
-
Hello.
Is this possible to change the background color of
.woodmart-cart-totals class
when an item is added to cart?
Can you provide us with a javascript snippet or something like that?
Thank you.
Hello,
Please provide the screen of the element. Is it in the sidebar or on cart page?
Best Regards
I try to do something like that.
I don’t know how to set the css style of a class inside a function.
Is this corrent?
function check_cart_contents() {
if ( WC()->cart->get_cart_contents_count() > 0 ) {
?>
<style>.woodmart-cart-totals{background-color: #d50000;}</style>
<?php
}
}
Ok i managed to make it work BUT you have to hit refreash to show the changed color. Is there anyway to make it compatible with ajax?
function check_cart_contents() {
if ( WC()->cart->get_cart_contents_count() > 0 ) {
?>
<style>.woodmart-cart-totals{background-color:#d50000; padding:10px}</style>
<?php
}
}
add_action( ‘wp_head’, ‘check_cart_contents’, 0 );
This code will not be updated with AJAX. We don’t have an instruction for such additional customization.
Maybe a simillar javascript function?
Sorry, but we don’t have a working function for this request.