PHP

How to add sms api in woocommerce website.

How to add sms api in woocommerce website.

  1. Login your wordPress dashboard.
  2. Go to WooCommerce menu & click the Settings menu.
  3. Click Emails Tab
  4. Copy file to Theme under HTML template & click Save changes
  5. then click to View Template
  6. then Paste the following codes & click Save changes button.
<?php
$firstName = $order->get_billing_first_name();
$lastName = $order->get_billing_last_name();
$send_to = $order->get_billing_phone();
$Order_No = $order->get_order_number();
$content = "Dear $firstName $lastName, Thanks for your order ($Order_No). Stay with us.

Hostick-BD Services";
$encodeMessage = urlencode($content);
$authKey = "***********";
$senderId = "*************";
$route = 4;

$data = array(
'authkey' => $authKey,
'mobiles' => $send_to,
'message' => $encodeMessage,
'sender' => $senderId,
'route' => $route );
$url = "************************";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($ch);
curl_close($ch);
?>

Leave a Reply

Your email address will not be published.