=== Barcode for WordPress ===
Contributors: barcodeapp
Tags: ecommerce, storefront, rtl, multilingual, woocommerce
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 8.1
Stable tag: 0.4.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Run your Barcode store as a WordPress storefront — bilingual (fa/en/ar), multi-currency, RTL-first.

== Description ==

Barcode for WordPress turns your existing Barcode store into a fast WordPress storefront:

* Product catalog and product pages via shortcodes or Gutenberg blocks
* Cart and checkout backed by your Barcode backend
* OTP customer login (phone), order history, order status lookup
* Multi-currency display with the customer currency selector
* Full RTL and fa/en/ar localization
* Canonical product and category URLs with WordPress sitemap integration
* Automatic localized StoreWebsite pages, menus, metadata, and structured data
* Optional WooCommerce bridge (use Barcode products inside WooCommerce)

Barcode remains the source of truth for product, cart, and order data. The plugin
communicates with it over a nonce-bound HMAC-SHA256 API and mirrors public catalog
metadata into managed WordPress posts and terms for canonical routing and SEO.

== Installation ==

1. Upload the `barcode` folder to `/wp-content/plugins/`, or install the ZIP via
   Plugins > Add New > Upload Plugin.
2. Activate the plugin through the Plugins menu in WordPress.
3. Go to Barcode > Settings and enter your Store ID, API Key, and API Secret
   from your Barcode dashboard.
4. Click Test Connection to confirm the credentials, then save.
5. Add the storefront to any page using the Barcode blocks (look for the
   "Barcode" category in the block inserter) or these shortcodes:
   `[barcode_catalog]`, `[barcode_product slug="stable-product-slug"]`, `[barcode_cart]`,
   `[barcode_checkout]`, `[barcode_login]`, `[barcode_account]`,
   `[barcode_order_status]`, `[barcode_currency]`, `[barcode_site_page]`.

== Frequently Asked Questions ==

= Does this require a Barcode account? =

Yes. You need a Barcode store and API credentials (Store ID, Key, Secret) from
your Barcode dashboard.

= I installed WooCommerce and my catalog page went blank =

WooCommerce picks a "shop" page for itself when it activates, and if you already
have a page whose slug is `shop` it adopts that one — after which WordPress
renders WooCommerce's product archive there instead of your page content, so the
Barcode shortcode on it never runs. Point WooCommerce at a different page in
WooCommerce > Settings > Products, or move `[barcode_catalog]` to another page.

= Does it work with WooCommerce? =

Optionally. Switch the plugin mode to "WooCommerce bridge" in Settings to expose
your Barcode products inside WooCommerce. The default "standalone" mode does not
require WooCommerce.

= Which languages and currencies are supported? =

The storefront is fully RTL-aware and ships fa, en, and ar locales. Prices are
shown in the customer's selected currency using your store's configured rates.

== Screenshots ==

1. Settings page with API credentials and connection test.
2. Storefront catalog rendered from the Barcode backend.
3. Product page with multi-currency pricing.
4. OTP login and customer order history.

== Changelog ==

= 0.4.0 =
* Prices are written the way the shopper reads them. Every price rendered as
  "300,000 IRR" — Latin digits and an ISO code — on storefronts whose market
  reads Persian. Persian now shows «۳۰۰٬۰۰۰ ریال» and Arabic «٣٠٠٬٠٠٠ ريال»,
  with the correct thousands separator and the currency named rather than
  coded. English is unchanged. Only the rendering changes; the amount does not.
* Fixed multi-store routing on a section's own landing page. A store filtered
  to the path `/en` matched `/en/products` but not `/en` itself, so a visitor
  arriving at the exact URL they were linked to was served the wrong store's
  catalog. `/en` now matches `/en`, `/en/` and `/en/…`, and still never matches
  `/english`.

= 0.3.1 =
* Security: the webhook endpoint now refuses replayed deliveries. It signs a
  nonce and timestamp specifically to prevent replay, but nothing recorded what
  had already been accepted, so a captured delivery could be sent again inside
  the five-minute skew window — re-running the handler and re-sending the
  customer their order confirmation each time. Every accepted delivery is now
  remembered by its signature for longer than the window it is valid for.
* Hardened the timestamp check against a same-namespace function override.

= 0.3.0 =
* Automatic updates. The plugin is installed from a zip rather than the
  wordpress.org directory, so WordPress had nowhere to look for new versions —
  a site installed today would have sat on that build forever. It now appears
  on the Plugins screen like any other plugin when a new version ships, with
  working "View details" and one-click update. Packages are only ever accepted
  from https://barcodeapp.ir, so a tampered manifest cannot install code from
  anywhere else.

= 0.2.2 =
* Fixed a dead link in WooCommerce bridge mode. The empty cart and checkout
  offer a "Browse products" button, and in bridge mode the product archive is
  deliberately never registered, so that button pointed at a page that did not
  exist. The catalogue link now resolves to whatever really exists: the product
  archive, else the WooCommerce shop page, else a page carrying
  [barcode_catalog], else the home page — and `barcode_catalog_url` lets you
  override it outright.
* WooCommerce bridge mode verified end to end for the first time: its three
  filters attach, the standalone product type correctly stays unregistered, and
  no page fatals in either mode with WooCommerce installed.

= 0.2.1 =
* Sold-out products no longer offer "Add to cart". The API reports stock per
  variant and the catalog and product shortcodes were ignoring it, so a shopper
  could add an out-of-stock item and only find out at the cart. They now show
  "Out of stock" instead, and the product page only offers variants that can
  actually be bought.
* The catalog's "Add to cart" buttons are styled like the rest of the
  storefront; they were falling back to raw browser buttons.

= 0.2.0 =
* The 17 Barcode blocks now appear in the editor. They were registered without
  a title or icon, which made every one of them unreachable in the inserter.
  They now sit in their own "Barcode" category.
* The product archive no longer steals `/shop/` from your own catalogue page.
  If a page already owns the slug, the archive steps aside.
* Product categories moved off `/category/`, which collided with WordPress's
  own category permalink base and made product category URLs resolve as blog
  categories.
* New: `[barcode_currency]` renders the customer currency picker. Previously
  the only way to change currency was to hand-edit the URL.
* The API secret is no longer written back into the settings page HTML, and
  the credential fields no longer invite browser password managers to autofill
  your personal login into them.
* "Test connection" now reports what actually went wrong — not configured,
  unreachable host, rejected key, rate limit or server error — instead of one
  fixed message.
* New: the order status page has a lookup form. It previously required a
  hand-written `?barcode_order=` parameter and was otherwise a dead end.
* Persian (fa_IR) and Arabic translations are bundled: 180 strings each.
* Storefront forms and buttons are styled; empty cart and checkout link back
  to the catalogue; the multi-store table scrolls in place instead of pushing
  the admin page sideways; product screens say "Add product", not "Add Post".

= 0.1.0 =
* Initial release: catalog, product, cart, checkout, OTP login, account,
  order status, RTL/fa-en-ar localization, theme injection,
  Gutenberg blocks, and optional WooCommerce bridge.

== Upgrade Notice ==

= 0.4.0 =
Persian and Arabic prices, and a multi-store routing fix for path filters.

= 0.3.1 =
Security fix for the webhook endpoint: replayed deliveries are now refused.
Recommended for every site.

= 0.3.0 =
Adds automatic updates — this is the last version you will have to install by
hand.

= 0.2.2 =
Fixes a "Browse products" button that led to a 404 in WooCommerce bridge mode.

= 0.2.1 =
Stops the storefront offering sold-out products for sale.

= 0.2.0 =
Fixes two URL collisions that could hide your catalogue page and your product
categories, makes the Barcode blocks visible in the editor, stops the API
secret being rendered into the admin page, and adds Persian and Arabic.

= 0.1.0 =
Initial release.
