title: How to make a `text + line-break + link` for sharing on Whatsapp?
body: <p>I tried many approaches online explaining the issue, but didn't find the one could fit with my need.  </p>
  
  <p>I want to make a <code>share to whatsapp</code> link on my website for each product, including <code>product name, line-break and link</code>. Something like this: </p>
  
  <pre><code>Product Name [/r/n]
  https://....
  </code></pre>
  
  <p>I'm using OpenCart 3. Here is php side code:  </p>
  
  <pre><code>'whatsapp_text' =&gt; $result['manufacturer'] . ' - ' . $result['model'] . ' - ' . $result['name']
      . $this-&gt;encodeURIComponent('\r\n' . $this-&gt;url-&gt;link('product/product', 'product_id=' . $result['product_id']))
  </code></pre>
  
  <p>Above code returns this: </p>
  
  <pre><code>https://api.whatsapp.com/send?text=Nurinu%20-%201310%20-%20Bra%5Cr%5Cnhttp%3A%2F%2Fwww.myweb.com%2Findex.php%3Froute%3Dproduct%2Fproduct%26amp%3Bproduct_id%3D61
  </code></pre>
  
  <p>According to this page (<a href="https://github.com/kriskbx/whatsapp-sharing/issues/16#issuecomment-294854157" rel="noreferrer">https://github.com/kriskbx/whatsapp-sharing/issues/16#issuecomment-294854157</a>) it's possible to use <code>window.encodeURIComponent(whatsappMessage)</code> to have a <code>line-break</code>, but I don't know how to combine it with my php code or use it in html side:</p>
  
  <pre><code>&lt;a href="https://api.whatsapp.com/send?text={{ product.whatsapp_text }}" data-action="share/whatsapp/share"&gt;Whatsapp&lt;/a&gt;
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I forgot to include the function (encodeURIComponent):  </p>
  
  <pre><code>function encodeURIComponent($str) {
  $revert = array('%21'=&gt;'!', '%2A'=&gt;'*', '%27'=&gt;"'", '%28'=&gt;'(', '%29'=&gt;')');
  return strtr(rawurlencode($str), $revert);
  }
  </code></pre>