=== Sidocode Availability Indicators for WooCommerce ===
Contributors: sidocode, kusimo
Tags: woocommerce, stock availability, availability indicators, stock status, product availability
Requires at least: 5.8
Tested up to: 6.9
Stable tag: 1.0.4
Requires PHP: 7.4
WC requires at least: 5.0
WC tested up to: 10.5
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Display color-coded bullet points next to WooCommerce stock messages. Customize responses for high, medium, and low stock levels with ease.

== Description ==

Sidocode Availability Indicators transforms your WooCommerce stock notifications into visually appealing, color-coded messages that help customers quickly understand product availability.

= Key Features =

* **Colored Bullet Points** - Green 🟢, Yellow 🟡, Red 🔴, and Black ⚫ indicators for different stock levels
* **Customizable Messages** - Set different messages for high, medium, and low stock levels
* **Simple Mode** - One-click solution to show "In stock, ready to ship" for all products
* **Dynamic Quantity Display** - Use {quantity} placeholder to show actual stock numbers
* **Fully Customizable Thresholds** - Define exactly when each stock level triggers
* **Single Item Special Message** - Display a unique message when only 1 item remains
* **No Coding Required** - All settings are managed through a simple admin interface

= Stock Level Indicators =

* 🟢 **Green** - High stock (fully customizable threshold)
* 🟡 **Yellow** - Medium stock (alert customers stock is running low)
* 🔴 **Red** - Low stock (create urgency to purchase)
* ⚫ **Black** - Out of stock

= Use Cases =

* **Create Urgency** - Show red bullets with "Hurry, only 3 left!" messages
* **Build Trust** - Green bullets with "In stock, ready to ship" reassure customers
* **Simple Stores** - Use Simple Mode for consistent "In stock" messaging
* **High-Volume Products** - Custom thresholds for different product types

= Perfect For =

* **E-commerce stores** wanting better stock visibility
* **Dropshipping sites** with varying inventory levels
* **Limited edition products** requiring urgency messaging
* **High-volume stores** with frequent stock changes

= Integration =

* Works seamlessly with all WooCommerce-enabled themes
* Compatible with variable products and simple products
* Respects WooCommerce stock management settings

== Installation ==

1. Upload the `sidocode-availability-indicators-for-woocommerce` folder to the `/wp-content/plugins/` directory
2. Activate the plugin through the 'Plugins' menu in WordPress
3. Navigate to **Settings → Sidocode Availability Indicators**
4. Configure your stock messages and thresholds
5. View your products to see the new stock messages in action

== Frequently Asked Questions ==

= Do I need WooCommerce installed? =

Yes, this plugin requires WooCommerce to be installed and activated. It will not work without WooCommerce.

= Will this work with my theme? =

Yes! The plugin works with any WooCommerce-compatible theme. It hooks into WooCommerce's native stock display system. If the indicator is not visible with your theme, use the **Product Page Display Position** setting under Advanced to inject it directly at a specific location on the product page.

= The indicator is showing as plain HTML code instead of a styled bullet — what do I do? =

Some themes read the stock status text and display it without rendering the HTML, causing the indicator markup to appear as raw code. To fix this, go to **Settings → Sidocode Availability Indicators → Advanced Placement** and change the **Product Page Display Position** from Default to one of the custom positions (After product title, After price, or After short description). This bypasses the theme's stock display entirely and injects the indicator directly into the page.

= Can I use different messages for different products? =

Currently, the settings apply globally. However, you can use custom thresholds and messages that work for most of your products. For product-specific messages, you would need custom development.

= What happens in Simple Mode? =

When Simple Mode is enabled, all in-stock products (regardless of quantity) will show a green bullet with "In stock, ready to ship". Out of stock products show a black bullet with "Out of stock".

= Can I use HTML in the messages? =

For security reasons, HTML is not allowed in message fields. Only plain text and the {quantity} placeholder are supported.

= How do I show the actual stock number? =

Use the `{quantity}` placeholder in your medium or low stock messages. For example: "Only {quantity} items remaining!"

= Will this affect my site's performance? =

No, the plugin is lightweight and uses efficient WordPress options API. It only loads on pages where stock information is displayed.

= Can I translate the messages? =

Yes! The plugin is fully translation-ready with the text domain 'sidocode-availability-indicators-for-woocommerce'. You can use translation plugins like Loco Translate or WPML.

= What happens if I deactivate the plugin? =

All custom stock messages will revert to WooCommerce's default stock messages. Your settings are saved in the database and will be restored if you reactivate the plugin.

= Does it work with variable products? =

Yes! Stock messages work perfectly with variable products and will update dynamically when customers select different variations.

= Can I customize the bullet colors? =

Currently, the bullets use standard emoji characters (🟢, 🟡, 🔴, ⚫). You can modify these by editing the plugin code, but this requires development knowledge.

= Will this work with caching plugins? =

Yes, the plugin works with most caching plugins since it uses server-side PHP to generate messages.

== Screenshots ==

1. Settings page showing all configuration options
2. Product page with green bullet for high stock
3. Product page with yellow bullet for medium stock
4. Product page with red bullet for low stock
5. Simple Mode in action

== Changelog ==

= 1.0.3 =
* Added "Hide until variation is selected" toggle in Advanced Placement settings — mirrors WooCommerce's default variable product behaviour
* Toggle is only shown when a custom display position is active and has no effect on simple products

= 1.0.2 =
* Added dynamic variation support for custom placement mode — the indicator now updates when a variation is selected and resets when the selection is cleared
* Added admin warning on the Advanced Placement setting explaining the variable product page-load behaviour and recommending Default mode for variable product stores
* Bumped inline script cache-busting versions to 1.0.2

= 1.0.1 =
* Added Product Page Display Position setting under Advanced for improved theme compatibility
* Added secondary woocommerce_stock_html filter to fix themes that escape availability text as plain HTML
* Added automatic DOM repositioning so custom positions render correctly on themes that place the product summary hook at the end of their layout
* Improved product loop display position options with clearer, consistent labels
* Added allowlist-based sanitisation for position settings

= 1.0.0 =
* Initial release
* Added colored bullet points for stock messages
* Added Simple Mode toggle
* Added customizable stock thresholds
* Added customizable messages with quantity placeholder
* Added settings page under Settings menu
* Added JavaScript to toggle advanced options

== Upgrade Notice ==

= 1.0.3 =
Adds a "Hide until variation is selected" option for stores using custom placement mode with variable products.

= 1.0.2 =
Adds dynamic variation support for custom placement mode and a variable product warning in the Advanced settings.

= 1.0.1 =
Improves theme compatibility. If you have been experiencing the availability indicator not displaying correctly with your theme, update and check the new Product Page Display Position setting under Advanced.

= 1.0.0 =
First stable release. All features are working and tested with WordPress 6.7 and WooCommerce 8.0+.

== Additional Information ==

= Support =

For support questions, bug reports, or feature requests, please use the WordPress.org support forums.

= Contributing =

Contributions are welcome! Feel free to submit pull requests or report issues on our GitHub repository.

= Credits =

Developed by sidocode and kusimo.

= Requirements =

* WordPress 5.8 or higher
* WooCommerce 5.0 or higher
* PHP 7.4 or higher

= Recommended Settings =

For best results:
1. Set high stock threshold to 10+
2. Set medium stock threshold to 5-10
3. Set low stock threshold to 1-4
4. Use urgency language for low stock messages
5. Enable Simple Mode for stores with consistent inventory

= Example Configurations =

**For Urgency-Driven Stores:**
- High: "✓ In stock" (Green)
- Medium: "⚠️ Only {quantity} left" (Yellow)
- Low: "🔥 Hurry! {quantity} remaining!" (Red)
- Single: "⚠️ Last one in stock!"

**For Professional/B2B Stores:**
- High: "In stock, ready to ship" (Green)
- Medium: "{quantity} units available" (Yellow)
- Low: "Limited stock available" (Red)

**For Simple Stores:**
- Enable Simple Mode
- All products show: "🟢 In stock, ready to ship"

= Technical Details =

The plugin uses:
- WordPress Settings API for configuration
- WooCommerce hooks for stock display
- Options API for data storage
- No external dependencies or API calls