title: Checkout querySelector
body: <p>I am relatively new to Javascript. I am trying to get the Price Value on our Checkout page.</p>
  <p>document.querySelector returns different values if the checkout is made via Prepayment and Paypal.</p>
  <p>Here is my code:</p>
  <pre><code>function() {
    try {
      var Prepayment = document.querySelector(&quot;.order-number&gt;strong&quot;).innerText.trim();
      var Paypal = document.querySelector(&quot;.checkout-success&gt;p&gt;span&quot;).innerText.trim();
    
      if (document.querySelector(&quot;.order-number&gt;strong&quot;) != null) {
        return capturedText;
      } else {
        return Paypal;
      }
    } catch(e) {
      return &quot;&quot;;
    }
  }
  </code></pre>
  <p>Upon using the Tag manager, the Tag is giving me &quot;&quot; value.</p>
  <p>Can someone help me how do i execute the queries with the QuerySelector within the If / Else environment, so does the function cannot block the entire script if my element which I am looking was not found.</p>