0

I have created Custom Button for "Order on WhatsApp" using the following Code at:

app/design/frontend/Smartwave/porto/Magento_Catalog/templates/product/view/addtocart.phtml

Please tell me how to change WhatsApp no for 2nd Magento store. I can show 2 different Whatsapp no for different stores

    <?php if ($_product->isSaleable()): ?>
         <button type="button"  title="Order on Whatsapp" class="action primary" 
         onclick=" window.open('https://wa.me/123456789 ?text=I want to order this product  <?php echo $_product->getProductUrl() ;?>/ ')"><span><span><i class="icon-us-dollar"></i>Order On Whatsapp</span></span></button> 
    <?php endif;?>
0

You can create custom settings for storeview like so

https://www.mageplaza.com/magento-2-module-development/create-system-xml-configuration-magento-2.html

This will allow you change values based on different stores. In the template fetch this settings and you will get the correct numbers.

Or you can write some custom javascript that will update the link based on domain.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.