| 开发者 | sahandz |
|---|---|
| 更新时间 | 2026年11月24日 21:50 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 7.1 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
sahand_uos_sms_gateways filter.%token10 عزیز، سفارش %token شما پرداخت نشد. کد تخفیف شما: %token2 تکمیل خرید: example.com/?suos=%token3Write the SMS text, check the token mapping, and save. Under the tokens you will find "Ready-made pattern text": press Copy, create a pattern with exactly this text in the Kavenegar panel and wait for its approval. Then enter the pattern name and save. The checkout link is already written as yoursite.com/?suos=%token3 when {link_code} is in token3. If a placeholder is not in any token, the plugin tells you which one.
Choose "Custom HTTP API (any provider)" and copy the endpoint and authentication details from your provider's API documentation. Enter one key=value parameter per line, for example: apikey=YOUR_KEY to={to} text={message} {to} is E.164 (for example +989120000000); {to_local} is the national form with a leading 0, based on your default country code. Parameters are substituted after parsing, then URL-encoded for GET/form or JSON-encoded without URL encoding for JSON. Optional headers use one Name: value per line. HTTP 2xx counts as success; set "Success text" if your provider also requires a specific response marker. The form supports flat key/value APIs; use the developer hook for APIs requiring nested payloads, signatures or another protocol.
Select "Another plugin (developer hook)". Add the following five-line example to your integration plugin, replacing my_sms_plugin_send with its actual send function and adapting its success result: add_filter( 'sahand_uos_send_sms', function ( $result, $to, $text, $context ) { if ( ! function_exists( 'my_sms_plugin_send' ) ) { return $result; } $sent = my_sms_plugin_send( $to, $text ); return true === $sent; }, 10, 4 ); The context contains order_id and recipient (customer/admin; test-customer/test-admin with order_id 0 for tests). Return true or an array with a truthy ok key for success. A null result means no plugin handled the filter. Only Kavenegar sends pre-approved patterns; the test gateway can preview them without sending.
Yes. Disable SMS and enable email independently for each recipient. Customer email uses the order's billing email and is skipped when invalid. Manager addresses are entered separately. Email uses the WooCommerce wrapper and wp_mail, so your SMTP/mail plugin handles delivery. A successful log means the transport accepted the message; it does not guarantee inbox delivery.
Leave "Keep messages on time on cached sites" enabled in WooCommerce > Unpaid Order SMS, then clear your page cache so cached pages include the small browser tick. It runs due rescue checks during visits even when a full-page cache serves the page. Visitors must allow JavaScript and local storage; no visits means no browser ticks. For reliable timing even without visitors, configure a real server cron to call wp-cron.php every 5 minutes, then add define('DISABLE_WP_CRON', true); to wp-config.php. The plugin shows a notice with your site's cron example if a check runs more than 15 minutes late.
Kavenegar accepts only one word in token, token2 and token3 (no spaces or half-spaces; it answers error 431). Put names and amounts in token10 or token20, which may contain spaces.
The order is cancelled first; the message is still sent, and the link rebuilds the cart.