Greetings. There is a code:

<div class="widget-content"> <ul class="products-list" data-lang="<?php echo $lang ?>"> <?php echo $yith_woocompare->obj->list_products_html(); ?> </ul> 

which by default displays html:

 <ul class="products-list" data-lang=""><li>Не выбраны блюда для сравнения</li></ul> 

I want to add a handler by condition:

  <?php if( $yith_woocompare->obj->list_products_html() !=" <li>Не выбраны товары для сравнения</li>") { ?> 

but not rolls ..

By typing I found out that the condition is fulfilled only after reloading the page.

  • he probably outputs and this is <ul class="products-list" data-lang=""> - splash58
  • $ yith_woocompare what's this? Maybe he has a method is_empty() ? Because the way you go is not very good. - ArchDemon 2:42 pm

1 answer 1

I think the problem is that it displays something about the dishes, and you check something about the goods :)))

 <li>Не выбраны блюда для сравнения</li> <li>Не выбраны товары для сравнения</li> 
  • no, I just made a mistake in the conclusion of the question - Vasya