Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding tag label to "<" in if statement #609

Open
Spleeding1 opened this issue Apr 26, 2022 · 3 comments
Open

Adding tag label to "<" in if statement #609

Spleeding1 opened this issue Apr 26, 2022 · 3 comments

Comments

@Spleeding1
Copy link

For some reason the closing </b> is messing with the < less than in the if statement. I switched it to if ($cart_item['quantity'] > $square_quantity) { to resolve it.

What it is supposed to look like:

if ($square_quantity < $cart_item['quantity']) {
    wc_clear_notices();
    wc_add_notice( __( '<p>We do not have enough <b>'.$cart_item['data']->name.'</b> in stock.
                                        Your cart has been updated with the available quantity.</p>', 'woocommerce' ), 'error' );
    $woocommerce->cart->set_quantity($cart_item_key, $square_quantity);
			}

What I get:

if ($square_quantity <b $cart_item['quantity']) {
    wc_clear_notices();
    wc_add_notice( __( '<p>We do not have enough <b>'.$cart_item['data']->name.'</b> in stock.
                                        Your cart has been updated with the available quantity.</p>', 'woocommerce' ), 'error' );
    $woocommerce->cart->set_quantity($cart_item_key, $square_quantity);
			}

or

if ($square_quantity < $cart_item['quantity']) {
    wc_clear_notices();
    wc_add_notice( __( '<p>We do not have enough <b>'.$cart_item['data']->name.'</> in stock.
                                        Your cart has been updated with the available quantity.</p>', 'woocommerce' ), 'error' );
    $woocommerce->cart->set_quantity($cart_item_key, $square_quantity);
			}
@head-gardener
Copy link

What are the steps to replicate? I don't seem to have any problems with this code

@Spleeding1
Copy link
Author

Spleeding1 commented Jul 12, 2022

  1. Create new .php file with opening <?php tag.
  2. Begin typing if statement.
  3. Issue will appear when closing </b> tag is reached.

or

  1. Copy/Paste if statement into new .php file with opening <?php tag.
  2. Change b in closing </b> tag to p.
tag-rename-1.mov

@head-gardener
Copy link

Yeah, i see it now. Seems like tags separated by a comparison sign will not connect:

<p> > </p>
or
'<p>' + (a<b? 'helo' : 'world') + '</p>'

A bug!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants