• Resolved gdpavle

    (@gdpavle)


    Hi

    I’m having trouble with learning how to check if the YITH cart is empty.

    Similarly to this code:

    // Hide WooCommerce Cart Icon When Empty
    add_action( 'wp_footer', function() {
        if ( WC()->cart->is_empty() ) {
            echo '<style type="text/css">#menu-item-1225{ display: none; }</style>';
        }
        else
            echo '<style type="text/css">#menu-item-1225{ display: inline-block; }</style>';
    });

    I would like to check if the YITH cart is empty and according to that, apply certain styles. WooCommerce cart would be checked with WC()->cart->is_empty() but this doesn’t seem to apply for YITH. Any suggestions?

    Many thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Carlos M

    (@cjmora)

    Hi @gdpavle,

    You can use this function:
    YITH_Request_Quote()->is_empty();

    The code you need is something similar to this:

    if ( function_exists( 'YITH_Request_Quote' ) ) {
    	add_action( 'wp_footer', function() {
    		if ( YITH_Request_Quote()->is_empty() ) {
    			echo '<style type="text/css">#menu-item-1225{ display: none; }</style>';
    		}
    		else
    			echo '<style type="text/css">#menu-item-1225{ display: inline-block; }</style>';
    	});
    }
    Plugin Support Emanuela Castorina

    (@kreamweb)

    Hi there,

    We haven’t heard from you in a while, so I’m going to mark this as resolved.
    Feel free to start a new thread if you need some information.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to check if YITH cart is empty’ is closed to new replies.