=== Loystar for WooCommerce ===
Contributors: LoystarApp
Donate link: https://loystar.co
Tags: woocommerce, customer, loyalty program, inventory, omni-channel, rewards, points
Requires at least: 5.8
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 3.4.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Keep your customers coming back and increase repeat sales with the Loystar WooCommerce Loyalty Program Plugin. Truly omni-channel.

== Description ==
The Loystar for WooCommerce plugin seamlessly integrates your WooCommerce store with the Loystar loyalty and retail platform. It connects your online store with your in-store sales, transactions, customer records, and loyalty programs in one unified place.

= Key Features =
* **Omni-Channel Loyalty:** Reward customers for repeat purchases both online and in-store.
* **Two-Way Order Status Sync:** Real-time bi-directional synchronization between WooCommerce and Loystar Online Orders. Statuses (processing, ready, paid, cancelled) stay synchronized instantly.
* **Real-Time Product & Inventory Sync:** Import products from Loystar to WooCommerce, or export WooCommerce catalog to Loystar with high-resolution image support and duplicate prevention.
* **Zero-Config App Marketplace Integration:** Automatically synchronizes store webhook credentials and ecommerce settings with Loystar.
* **Customer Loyalty Widget & My Account Integration:** Customers can view their loyalty points, stamps, and rewards directly on their account dashboard and via the embedded widget.
* **Flexible Checkout Integration:** Optional birthday and gender collection at checkout to power automated birthday SMS/email marketing.
* **HPOS Ready:** Fully compatible with WooCommerce High-Performance Order Storage (Custom Order Tables).

= Create your Loystar Account =
Don't have an account? Sign up at [https://loystar.co](https://loystar.co).

== Installation ==
1. Upload the plugin folder `loystar-woocommerce-loyalty-program` to the `/wp-content/plugins/` directory, or install directly through the WordPress Plugins screen.
2. Activate the plugin through the 'Plugins' menu in WordPress.
3. Navigate to **WooCommerce > Loystar Settings** in your WordPress admin dashboard.
4. Enter your Loystar merchant email and password to connect your store.
5. Select your loyalty program, configure your target ecommerce branch, and enable two-way sync.

== Frequently Asked Questions ==
= Do my customers need to download a separate mobile app? =
No. Online customers simply earn rewards through your WooCommerce checkout. They can track their rewards balance directly in their WooCommerce My Account dashboard or on the store's loyalty widget.

= Does this support WooCommerce High-Performance Order Storage (HPOS)? =
Yes. The plugin fully declares compatibility with WooCommerce HPOS (Custom Order Tables).

= How does Two-Way Order Status Sync work? =
When an order is placed on WooCommerce, it is immediately streamed to your Loystar dashboard. When staff fulfill, mark as ready, or cancel the order in Loystar, the status update is delivered back to WooCommerce via secure webhooks.

= Can I import my existing Loystar inventory into WooCommerce? =
Yes. You can import products, categories, variants, and stock levels from Loystar into WooCommerce with live progress tracking, as well as export WooCommerce products to Loystar.

== Screenshots ==
1. Connect your Loystar account and configure settings.
2. Two-Way Order Sync & Webhook settings.
3. Import and export catalog with duplicate prevention.
4. Customer loyalty program status and widget.

== Changelog ==
= 3.4.2 =
* NEW: Branch Selector on Sync page allows merchants to choose which Loystar branch to import products from before starting the sync.
* FIX: Loystar product counts now accurately query the specific selected branch catalog instead of defaulting to the home branch.
* NEW: Added 1-click "Import from Home Branch" action when the selected branch has 0 products or returns an empty branch notice.

= 3.4.1 =
* FIX: Resolved critical error on login by executing auth handlers before HTML output and hardening API error handling.
* NEW: Real-time Ecommerce Branch management and refresh card in settings with auto-detection.
* FIX: Normalized branch API response parsing for single-branch merchants.
* UPDATED: Brand logo and repository showcase banners.

= 3.4.0 =
* NEW: Two-Way Order Status Sync between WooCommerce and Loystar Online Orders via secure webhook.
* NEW: Automatic store settings and webhook secret synchronization to Loystar App Marketplace.
* NEW: Optional Date of Birth and Gender checkout fields with clean styling.
* ENHANCEMENT: Real-time order streaming to Loystar dashboard.
* ENHANCEMENT: High-Performance Order Storage (HPOS) compatibility declared and verified.
* ENHANCEMENT: Production M-Tier GraphQL endpoint integration.
* FIX: Product deduplication logic during import/export matching by SKU, URL, and normalized name.
* FIX: Preserved decimal precision on all order totals and line items.

= 3.2.8 =
* FIX: Login authentication validation and settings page stability.
* ENHANCEMENT: MTier GraphQL integration reliability.

= 3.2.7 =
* UPDATED: Production API endpoints configuration.

= 3.2.6 =
* FIX: Order total decimal precision preservation.
* FIX: Prevented duplicate sales transaction submissions.

= 3.2.3 =
* NEW: GraphQL MTier integration for real-time order synchronization.

= 3.2.0 =
* NEW: Scheduled automatic background product synchronization.
* ENHANCEMENT: Real-time progress visualization for catalog imports.

= 2.1.0 =
* NEW: Added minified asset pipelines.
* FIX: Date of birth field formatting and phone number styling across themes.

= 2.0.0 =
* NEW: Product synchronization and inventory tracking.
* NEW: Customer loyalty widget and loyalty program options.

= 1.0.0 =
* Initial release on WordPress.org.

== Upgrade Notice ==
= 3.4.2 =
Upgrade to version 3.4.2 for selectable import branches, accurate branch-specific product counts, and 1-click Home Branch import fallback.

= 3.4.1 =
Upgrade to version 3.4.1 for critical login fixes, enhanced branch auto-detection, and brand asset updates.

= 3.4.0 =
Upgrade to version 3.4.0 for real-time two-way order status sync with Loystar Online Orders, HPOS compatibility, and enhanced inventory sync.

== Privacy Policy ==
This plugin connects to the Loystar service to synchronize customer, order, and product data. Please review Loystar's privacy policy at https://loystar.co/privacy to understand how your data is handled.

== Third-Party Services ==
This plugin relies on the Loystar API service (https://api.loystar.co, https://mtier2.loystar.co, and https://sell.loystar.co) to provide omni-channel loyalty and order sync functionality. By using this plugin, you agree to Loystar's terms of service available at https://loystar.co/terms.
