The default shortcode uses the active theme's native WooCommerce product-search results.
Documentation
Set up and use Search with AI for WooCommerce.
A practical guide for installing the plugin, choosing a results flow, configuring AI providers, enabling image search, rebuilding the catalog index, and troubleshooting common setup problems.
Overview
What the plugin does
Search with AI for WooCommerce adds a shopper-facing product search experience to a WooCommerce store. Shoppers can type natural requests, optionally upload a product image, and reach either the theme's native WooCommerce search results or a dedicated shortcode results page.
Text search can still work without an AI provider key through local catalog matching.
AI improves intent understanding, reranking, and image analysis when configured.
نظرة عامة
ماذا تفعل الإضافة
تضيف Search with AI for WooCommerce تجربة بحث منتجات للمتسوقين داخل متجر ووكومرس. يمكن للمتسوق كتابة طلب طبيعي، أو رفع صورة منتج اختياريا، ثم الوصول إما إلى نتائج بحث ووكومرس الأصلية في القالب أو إلى صفحة نتائج مخصصة عبر الشورت كود.
الشورت كود الافتراضي يستخدم نتائج بحث منتجات ووكومرس الأصلية في القالب النشط.
يمكن أن يعمل البحث النصي بدون مفتاح مزود ذكاء اصطناعي عبر مطابقة الكتالوج المحلية.
يحسن الذكاء الاصطناعي فهم نية البحث، وإعادة ترتيب النتائج، وتحليل الصور عند ضبطه.
Requirements
Before you install
- WordPress 6.4 or newer.
- PHP 7.4 or newer.
- WooCommerce active and the normal Shop/search pages working.
- Rank Math is optional. Supported Rank Math fields are indexed when present.
- An AI provider key is optional for text search and required for image search.
- A vision-capable AI model is required when image search is enabled.
المتطلبات
قبل التثبيت
- ووردبريس 6.4 أو أحدث.
- PHP 7.4 أو أحدث.
- تفعيل ووكومرس والتأكد من أن صفحة المتجر والبحث العادي تعملان بشكل صحيح.
- Rank Math اختياري. يتم فهرسة حقوله المدعومة عند وجودها.
- مفتاح مزود الذكاء الاصطناعي اختياري للبحث النصي ومطلوب للبحث بالصور.
- يلزم نموذج يدعم الرؤية عند تفعيل البحث بالصور.
License
Activate the pro build
The free build can run without vendor license activation. The private/pro build requires an active license before storefront search features are available to shoppers.
- In WordPress admin, open Search with AI > Activation.
- Paste the license key exactly as provided after purchase.
- Click Activate License.
- Use Check License when you move the site, change the domain, or need to confirm status.
- Use Deactivate License before moving the license to another site.
https://plugin-licenses.onlineshopcatalogue.co.uk/api/licenses. Developers can override
that endpoint with SWAI_LICENSE_API_BASE.
الترخيص
تفعيل إصدار Pro
يمكن أن يعمل الإصدار المجاني بدون تفعيل ترخيص من البائع. أما الإصدار الخاص/Pro فيحتاج إلى ترخيص نشط قبل إتاحة وظائف البحث في واجهة المتجر للزوار.
- من لوحة تحكم ووردبريس، افتح Search with AI > Activation.
- الصق مفتاح الترخيص تماما كما وصلك بعد الشراء.
- اضغط Activate License.
- استخدم Check License عند نقل الموقع أو تغيير الدومين أو عند الحاجة للتحقق من الحالة.
- استخدم Deactivate License قبل نقل الترخيص إلى موقع آخر.
https://plugin-licenses.onlineshopcatalogue.co.uk/api/licenses. يمكن للمطورين تغيير الرابط عبر
SWAI_LICENSE_API_BASE.
Quick Start
Recommended setup for a new store
- Install the plugin folder in
/wp-content/plugins/or upload the plugin zip from the WordPress plugins screen. - Activate Search with AI for WooCommerce.
- Make sure WooCommerce is active.
- For the pro build, open Search with AI > Activation, enter the license key, and click Activate License.
- Open Search with AI > Settings.
- Leave AI off if you only want local text matching, or configure a provider if you want AI understanding or image search.
- Create or edit a page and add
[swai_search]. - Click Rebuild Product Index after product imports or large catalog edits.
- Run a test search from the storefront.
[swai_search] first. It keeps your theme's product cards, sorting,
filters, and pagination.
بداية سريعة
الإعداد الموصى به لمتجر جديد
- ثبّت مجلد الإضافة داخل
/wp-content/plugins/أو ارفع ملف zip من شاشة إضافات ووردبريس. - فعّل Search with AI for WooCommerce.
- تأكد من أن ووكومرس مفعّل.
- في إصدار Pro، افتح Search with AI > Activation، أدخل مفتاح الترخيص، واضغط Activate License.
- افتح Search with AI > Settings.
- اترك الذكاء الاصطناعي غير مفعّل إذا أردت المطابقة النصية المحلية فقط، أو اضبط مزودا إذا أردت فهم النية أو البحث بالصور.
- أنشئ صفحة أو عدّل صفحة موجودة وأضف
[swai_search]. - اضغط Rebuild Product Index بعد استيراد المنتجات أو تعديل الكتالوج بشكل كبير.
- جرّب البحث من واجهة المتجر.
[swai_search] أولا. هذا يحافظ على بطاقات المنتجات والفرز والفلاتر وترقيم الصفحات في قالبك.
Results Flow
Choose native mode or shortcode mode
| Mode | Use it when | What happens |
|---|---|---|
| Native | Your theme already has good WooCommerce product result pages. | The form redirects to native WooCommerce product search with post_type=product and swai_native=1. |
| Shortcode | You want a dedicated AI search results page or your theme search template is not suitable. | The plugin renders paginated product cards from the shortcode using swai_query, swai_page, and optional swai_token. |
مسار النتائج
اختر الوضع الأصلي أو وضع الشورت كود
| الوضع | متى تستخدمه | ماذا يحدث |
|---|---|---|
| أصلي | عندما تكون صفحات نتائج منتجات ووكومرس في قالبك جيدة بالفعل. | يرسل النموذج المستخدم إلى بحث منتجات ووكومرس الأصلي مع post_type=product و swai_native=1. |
| شورت كود | عندما تريد صفحة نتائج بحث ذكاء اصطناعي مخصصة أو عندما لا يناسبك قالب البحث. | تعرض الإضافة بطاقات منتجات مرقمة عبر الشورت كود باستخدام swai_query و swai_page و swai_token عند وجود صورة. |
Shortcodes
Shortcode reference
[swai_search]Default search form. Uses native WooCommerce results.[swai_search results_mode="native"]Explicit native mode.[swai_search results_mode="shortcode" results_page_url="/ai-search-results/"]Put this on the search-entry page.[swai_search results_mode="shortcode" per_page="9"]Put this on the dedicated results page.Attributes
| Attribute | Default | Purpose |
|---|---|---|
results_mode | native | Use native or shortcode. |
results_page_url | Current/local page | Target page for shortcode mode. Use a local URL or path such as /ai-search-results/. |
per_page | 9 | Number of plugin-hosted results per page. It is clamped between 1 and 120. |
placeholder | Example prompt text | Custom placeholder for the search input. |
button_label | Search | Custom submit button text. |
Dedicated results setup
- Create a page with slug
ai-search-results. - On that results page, add
[swai_search results_mode="shortcode" per_page="9"]. - On the search-entry page, add
[swai_search results_mode="shortcode" results_page_url="/ai-search-results/"]. - Run a test search and confirm the URL includes
swai_query=....
الشورت كود
مرجع الشورت كود
[swai_search]نموذج البحث الافتراضي. يستخدم نتائج ووكومرس الأصلية.[swai_search results_mode="native"]الوضع الأصلي بشكل صريح.[swai_search results_mode="shortcode" results_page_url="/ai-search-results/"]ضعه في صفحة بدء البحث.[swai_search results_mode="shortcode" per_page="9"]ضعه في صفحة النتائج المخصصة.الخصائص
| الخاصية | الافتراضي | الغرض |
|---|---|---|
results_mode | native | استخدم native أو shortcode. |
results_page_url | الصفحة الحالية/المحلية | صفحة الهدف في وضع الشورت كود. استخدم رابطا محليا مثل /ai-search-results/. |
per_page | 9 | عدد النتائج المعروضة في كل صفحة. يتم ضبطه بين 1 و 120. |
placeholder | نص مثال داخل الحقل | تخصيص النص الظاهر داخل حقل البحث. |
button_label | Search | تخصيص نص زر الإرسال. |
إعداد صفحة نتائج مخصصة
- أنشئ صفحة بالاسم اللطيف
ai-search-results. - في صفحة النتائج، أضف
[swai_search results_mode="shortcode" per_page="9"]. - في صفحة بدء البحث، أضف
[swai_search results_mode="shortcode" results_page_url="/ai-search-results/"]. - جرّب البحث وتأكد أن الرابط يحتوي على
swai_query=....
Admin Settings
Settings reference
| Setting | Default | How to use it |
|---|---|---|
| Enable AI Understanding | Off | Turn on for provider-powered query understanding and reranking. |
| AI Provider | OpenAI | Choose OpenAI, Anthropic Claude, Google Gemini, or OpenAI-compatible / Custom. |
| AI Provider API Key | Empty | Enter the key from the selected provider. Leave empty for fallback matching. |
| AI Provider Base URL | Empty | Only needed for OpenAI-compatible custom providers, usually ending in /v1. |
| AI Model | gpt-4o-mini | Use any model ID supported by the selected provider. |
| Max Products Per Reply | 6 | Controls product count in widget/chat replies. Maximum is 120. |
| Enable Image Search | On | Only works when the selected provider/model supports image input. |
| Primary Color | #FCB800 | Main accent color for buttons, highlights, and active states. |
| Secondary Color | #000000 | Support color for text, borders, and contrast elements. |
| AI System Prompt | Empty | Optional override for AI behavior. Keep the AI response JSON-only with reply and queries. |
إعدادات الإدارة
مرجع الإعدادات
| الإعداد | الافتراضي | طريقة الاستخدام |
|---|---|---|
| Enable AI Understanding | غير مفعّل | فعّله عندما تريد فهم نية البحث وإعادة ترتيب النتائج عبر مزود ذكاء اصطناعي. |
| AI Provider | OpenAI | اختر OpenAI أو Anthropic Claude أو Google Gemini أو OpenAI-compatible / Custom. |
| AI Provider API Key | فارغ | أدخل المفتاح من المزود المحدد. اتركه فارغا للمطابقة الاحتياطية. |
| AI Provider Base URL | فارغ | مطلوب فقط للمزودين المخصصين المتوافقين مع OpenAI، وغالبا ينتهي بـ /v1. |
| AI Model | gpt-4o-mini | استخدم أي معرف نموذج يدعمه المزود المحدد. |
| Max Products Per Reply | 6 | يتحكم بعدد المنتجات في ردود المحادثة/الويدجت. الحد الأقصى 120. |
| Enable Image Search | مفعّل | يعمل فقط عندما يدعم المزود والنموذج إدخال الصور. |
| Primary Color | #FCB800 | لون الأزرار والتمييز والحالات النشطة. |
| Secondary Color | #000000 | لون داعم للنصوص والحدود وعناصر التباين. |
| AI System Prompt | فارغ | تجاوز اختياري لسلوك الذكاء الاصطناعي. حافظ على الرد بصيغة JSON فقط مع reply و queries. |
AI Providers
Provider setup
| Provider | Base URL | Example model |
|---|---|---|
| OpenAI | Leave empty | gpt-4o-mini |
| Anthropic Claude | Leave empty | claude-sonnet-4-20250514 |
| Google Gemini | Leave empty | gemini-2.5-flash |
| OpenAI-compatible / Custom | https://api.example.com/v1 | The provider's model ID |
- Select the provider in Search with AI > Settings.
- Enter the API key and model ID from the same provider account.
- Only fill Base URL for OpenAI-compatible custom providers.
- Click Test Provider.
- If the test fails, verify provider, API key, model ID, and base URL are from the same account.
مزودو الذكاء الاصطناعي
إعداد المزود
| المزود | الرابط الأساسي | مثال للنموذج |
|---|---|---|
| OpenAI | اتركه فارغا | gpt-4o-mini |
| Anthropic Claude | اتركه فارغا | claude-sonnet-4-20250514 |
| Google Gemini | اتركه فارغا | gemini-2.5-flash |
| OpenAI-compatible / Custom | https://api.example.com/v1 | معرف النموذج لدى المزود |
- اختر المزود من Search with AI > Settings.
- أدخل مفتاح API ومعرف النموذج من نفس حساب المزود.
- املأ Base URL فقط للمزودين المخصصين المتوافقين مع OpenAI.
- اضغط Test Provider.
- إذا فشل الاختبار، تأكد أن المزود والمفتاح ومعرف النموذج والرابط الأساسي تابعون لنفس الحساب.
Image Search
Enable product search by image
- Choose an AI provider.
- Use a model that supports image or vision input.
- Add the provider API key and model ID.
- Turn on Enable Image Search.
- Save settings and test with a clear product photo.
Uploaded images are accepted as JPEG, PNG, WebP, or GIF and are limited to 5 MB. The image is sent to the selected AI provider for visual understanding. Keep image search disabled when using a text-only model.
البحث بالصور
تفعيل البحث عن المنتجات بالصورة
- اختر مزود ذكاء اصطناعي.
- استخدم نموذجا يدعم إدخال الصور أو الرؤية.
- أضف مفتاح API ومعرف النموذج.
- فعّل Enable Image Search.
- احفظ الإعدادات وجرب صورة منتج واضحة.
يتم قبول صور JPEG و PNG و WebP و GIF بحد أقصى 5 ميجابايت. تُرسل الصورة إلى مزود الذكاء الاصطناعي المحدد لفهمها بصريا. أبق البحث بالصور غير مفعّل إذا كنت تستخدم نموذجا نصيا فقط.
Catalog Index
What gets indexed and when to rebuild
The plugin builds a searchable product text blob for published products and keeps it in product meta.
- Product title, short description, full description, and SKU.
- Categories, tags, product attributes, and attribute values.
- Variation SKU, variation attributes, and variation descriptions.
- Featured/gallery image alt text, title, caption, and description.
- Rank Math fields:
rank_math_title,rank_math_description, andrank_math_focus_keyword.
Rebuild the index after bulk imports, CSV imports, major catalog edits, attribute changes, or SEO metadata changes.
فهرس الكتالوج
ما الذي تتم فهرسته ومتى تعيد البناء
تبني الإضافة نصا قابلا للبحث لكل منتج منشور وتخزنه في بيانات المنتج.
- عنوان المنتج، الوصف القصير، الوصف الكامل، و SKU.
- التصنيفات، الوسوم، سمات المنتج، وقيم السمات.
- SKU المتغيرات، سمات المتغيرات، وأوصاف المتغيرات.
- نص alt وعنوان ووصف وتعليق الصور البارزة وصور المعرض.
- حقول Rank Math:
rank_math_titleوrank_math_descriptionوrank_math_focus_keyword.
أعد بناء الفهرس بعد الاستيراد الجماعي، أو استيراد CSV، أو تعديلات الكتالوج الكبيرة، أو تغييرات السمات، أو تغييرات بيانات SEO.
Floating Widget
Where the AI search widget appears
The floating widget is designed for WooCommerce product-discovery pages. It does not render in the WordPress admin area and it waits until WooCommerce is available.
- By default it appears on shop, product, product category, product tag, and product taxonomy pages.
- In the pro build, the widget requires an active license for storefront use.
- The public chat route is
/wp-json/swai/v1/chat. - REST chat requests are rate-limited to 25 requests per 5 minutes per visitor fingerprint.
- Developers can control visibility with the
swai_should_render_widgetfilter.
الويدجت العائم
أين يظهر ويدجت بحث الذكاء الاصطناعي
صمم الويدجت العائم لصفحات اكتشاف منتجات ووكومرس. لا يظهر داخل لوحة تحكم ووردبريس، وينتظر حتى يكون ووكومرس جاهزا.
- افتراضيا يظهر في صفحات المتجر، المنتج، تصنيف المنتج، وسم المنتج، وتصنيفات المنتجات.
- في إصدار Pro يحتاج الويدجت إلى ترخيص نشط حتى يعمل في واجهة المتجر.
- مسار المحادثة العام هو
/wp-json/swai/v1/chat. - طلبات REST للمحادثة محددة بـ 25 طلبا كل 5 دقائق لكل بصمة زائر.
- يمكن للمطورين التحكم في الظهور عبر فلتر
swai_should_render_widget.
Testing
Final setup checklist
- Confirm WooCommerce is active and the shop page loads products normally.
- Save the plugin settings once, even if you keep the default values.
- If AI is enabled, click Test Provider before testing the storefront.
- Run one short keyword search, one natural-language search, and one SKU search.
- If image search is enabled, test JPEG, PNG, and WebP files under 5 MB.
- Check the result URL in shortcode mode and confirm it includes
swai_query. - After importing products, click Rebuild Product Index and test again.
الاختبار
قائمة التحقق النهائية بعد الإعداد
- تأكد من تفعيل ووكومرس وأن صفحة المتجر تعرض المنتجات بشكل طبيعي.
- احفظ إعدادات الإضافة مرة واحدة حتى لو أبقيت القيم الافتراضية.
- إذا كان الذكاء الاصطناعي مفعلا، اضغط Test Provider قبل اختبار واجهة المتجر.
- جرّب بحثا بكلمة قصيرة، وبحثا بجملة طبيعية، وبحثا باستخدام SKU.
- إذا كان البحث بالصور مفعلا، جرّب ملفات JPEG وPNG وWebP أقل من 5 ميجابايت.
- في وضع الشورت كود، تحقق من رابط النتائج وتأكد أنه يحتوي على
swai_query. - بعد استيراد المنتجات، اضغط Rebuild Product Index ثم اختبر مرة أخرى.
Privacy
External services and data flow
The plugin only needs external AI calls when AI understanding or image search is enabled. Review your chosen provider's terms and privacy policy before using it on a live store.
| Service | When it is used | Data involved |
|---|---|---|
| AI provider | AI understanding, reranking, chat replies, and image search. | Search query, selected catalog context, and uploaded image when image search is used. |
| License API | Activation, status checks, scheduled checks, and deactivation in the pro build. | License key, site URL/domain metadata, plugin/version metadata, and license status proof data. |
الخصوصية
الخدمات الخارجية وتدفق البيانات
تحتاج الإضافة إلى اتصال خارجي بمزود الذكاء الاصطناعي فقط عند تفعيل فهم الذكاء الاصطناعي أو البحث بالصور. راجع شروط وسياسة خصوصية المزود قبل استخدامه في متجر مباشر.
| الخدمة | متى تستخدم | البيانات المستخدمة |
|---|---|---|
| مزود الذكاء الاصطناعي | فهم النية، إعادة ترتيب النتائج، ردود المحادثة، والبحث بالصور. | عبارة البحث، سياق محدد من الكتالوج، والصورة المرفوعة عند استخدام البحث بالصور. |
| واجهة الترخيص | التفعيل، فحص الحالة، الفحوصات المجدولة، وإلغاء التفعيل في إصدار Pro. | مفتاح الترخيص، رابط/دومين الموقع، بيانات الإضافة/الإصدار، وبيانات إثبات حالة الترخيص. |
Troubleshooting
Common problems and fixes
| Problem | Fix |
|---|---|
| Shortcode shows WooCommerce missing message. | Activate WooCommerce first. |
| Pro storefront search does not run. | Activate the license from the Activation page and check status. |
| AI provider test fails. | Check provider selection, API key, model ID, and custom base URL. |
| Image search fails or falls back. | Use a vision-capable model and keep image search enabled only for that model. |
| Shortcode mode redirects but shows no results. | Verify results_page_url, the results page shortcode, and that the URL includes swai_query. |
| New products do not appear. | Rebuild Product Index after imports or large edits. |
حل المشاكل
مشاكل شائعة وحلولها
| المشكلة | الحل |
|---|---|
| الشورت كود يعرض رسالة أن ووكومرس غير موجود. | فعّل ووكومرس أولا. |
| بحث الواجهة لا يعمل في إصدار Pro. | فعّل الترخيص من صفحة Activation وتحقق من الحالة. |
| اختبار مزود الذكاء الاصطناعي يفشل. | راجع اختيار المزود ومفتاح API ومعرف النموذج والرابط الأساسي المخصص. |
| البحث بالصور يفشل أو يعود للبحث النصي. | استخدم نموذجا يدعم الرؤية وفعّل البحث بالصور فقط لذلك النموذج. |
| وضع الشورت كود يحول المستخدم لكن لا يعرض نتائج. | تحقق من results_page_url، وشورت كود صفحة النتائج، وأن الرابط يحتوي على swai_query. |
| المنتجات الجديدة لا تظهر. | أعد بناء فهرس المنتجات بعد الاستيراد أو التعديلات الكبيرة. |
Developer Notes
Implementation reference
- Provider settings are stored in
swai_options. - Provider key:
ai_provider. Supported values:openai,anthropic,gemini,openai_compatible. - API key and model option names remain
openai_api_keyandopenai_modelfor backward compatibility. - Provider routing lives in
includes/class-swai-ai-service.php. - Settings fields, shortcodes, REST route, AJAX actions, and license checks live in
includes/class-swai-plugin.php. - Frontend widget JS lives in
assets/js/swai-widget.js. - Admin provider/license JS lives in
assets/js/swai-admin.js. - The public REST chat endpoint is
/wp-json/swai/v1/chat. - The floating widget renders only on WooCommerce discovery views by default and can be controlled with the
swai_should_render_widgetfilter.
ملاحظات للمطورين
مرجع التنفيذ
- تخزن إعدادات المزود في
swai_options. - مفتاح المزود:
ai_provider. القيم المدعومة:openaiوanthropicوgeminiوopenai_compatible. - تظل أسماء خيارات المفتاح والنموذج
openai_api_keyوopenai_modelللتوافق مع الإصدارات السابقة. - توجيه طلبات المزود موجود في
includes/class-swai-ai-service.php. - حقول الإعدادات والشورت كود ومسار REST وطلبات AJAX وفحوصات الترخيص موجودة في
includes/class-swai-plugin.php. - جافاسكربت الويدجت في الواجهة موجود في
assets/js/swai-widget.js. - جافاسكربت الإدارة للمزود والترخيص موجود في
assets/js/swai-admin.js. - مسار REST العام للمحادثة هو
/wp-json/swai/v1/chat. - يظهر الويدجت العائم افتراضيا في صفحات اكتشاف منتجات ووكومرس فقط، ويمكن التحكم به عبر فلتر
swai_should_render_widget.