Home Forums WoodMart support forum Change Background Color / Item in Cart

Change Background Color / Item in Cart

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #63708

    newsprince
    Participant

    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.

    #63719

    Hello,

    Please provide the screen of the element. Is it in the sidebar or on cart page?

    Best Regards

    #63722

    newsprince
    Participant

    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
    }
    }

    #63724

    newsprince
    Participant

    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 );

    #63726

    Artem Temos
    Keymaster

    This code will not be updated with AJAX. We don’t have an instruction for such additional customization.

    #63727

    newsprince
    Participant

    Maybe a simillar javascript function?

    #63740

    Artem Temos
    Keymaster

    Sorry, but we don’t have a working function for this request.

Viewing 7 posts - 1 through 7 (of 7 total)