I wonder what’s wrong with this code:
if ( isset( $_POST['add-to-cart'] ) ) && $matched_id = (int) $_POST['add-to-cart'] ) {
$url = 'https://website.com/cart/?add-to-cart=363053';
}
It returned a syntax error, unexpected ‘&&’ (T_BOOLEAN_AND)
2
Answers
You missed some brackets…
Try adding brackets like :
Or removing some brackets like :
Remove following part from example I have given when issue fixed…
if ( isset( $_POST['add-to-cart'] ) && $matched_id = (int) $_POST['add-to-cart'] ) { $url = 'https://website.com/cart/?add-to-cart=363053'; }
I think that you have to remove the bracket.