Basically I am hacking a foxycart setup I run and I need to basically hide a certain shipping option should a few things on the page exist...
1) that $value != United States (this is pulled dynamically from a text input but for purposes of showing you I've made it a static variable here
2) the number '.fc_cart_item' occurs is only once
3) the text in '.fc_cart_item_quantity' is only 1
and
4) the text in #fc_cart_table contains either Xyz or Zyx
Here is my statement that kinda works...
var value = 'Australia';
if(
( $value != 'United States' && $('.fc_cart_item').size() < 2 && $('.fc_cart_item_quantity').text() < 2 ) &&
( $('#fc_cart_table:contains(\'Zyx\')') || $('#fc_cart_table:contains(\'Xyz\')') )
)
{
// do stuff
}
Now this was working (whatever I put in // do stuff would occur) as I expect it when I had Xyz or Zyx in the cart... but then it was still doing stuff even when it was something other than Xyz or Zyx.
I'm coming from a PHP background so I don't know if I'm doing my if statement correctly here.