=== RecordToko ===
Contributors: original69
Donate link: https://ko-fi.com/4eachother
Tags: discogs, woocommerce, vinyl, records, import
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 0.1.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Import and manage your Discogs record inventory in WooCommerce.

== Description ==

Built for record shops and collectors who sell on Discogs and want their own webshop next to it - without maintaining two inventories by hand.

RecordToko imports your Discogs marketplace inventory straight into WooCommerce, so you don't have to list every record twice.

**Features**

* Import from a Discogs inventory-export CSV, or fetch and download the export directly from Discogs from inside wp-admin.
* Enriches each listing with cover image, tracklist, and genres/styles from the Discogs release catalogue.
* Price rules: apply a percentage or fixed adjustment to Discogs prices, with an optional floor price and psychological (x.95) rounding, plus a per-item override at import time.
* A dry-run preview is mandatory before anything is written — see exactly what will be created, updated, or skipped, and review any errors, before a single product changes.
* A change log records every create/update action so you can see what happened and when.
* Your own product photos always take priority — the plugin never overwrites a photo you added yourself with a Discogs cover image.

**What you can do with it**

*Getting your inventory in*

* Upload a Discogs inventory-export CSV by hand (up to 10 MB), or let the plugin request and download the export straight from your Discogs account — no file juggling.
* Works with or without a Discogs personal access token. Without one the plugin still runs, at Discogs' lower anonymous rate limit; the settings screen tells you so.
* Every import is resumable and batched in the background, so an inventory of hundreds or thousands of records does not time out.

*Deciding what your prices are*

* Choose a percentage adjustment (for example -20% because you save the marketplace fee) or a fixed amount up or down.
* Set an optional floor price so nothing is ever listed below what you are willing to accept.
* Switch on psychological rounding to land prices on x.95 — rounding only ever lowers a price, never raises it.
* Override the price of any individual record in WooCommerce afterwards; a later re-import will not undo your prices unless you want it to.

*Seeing what will happen before it happens*

* A dry-run preview is mandatory: totals for what will be created and updated, plus a sample of enriched rows exactly as they will appear.
* Malformed data is refused loudly, with the offending row named — for example a price written as "9,99" instead of "9.99" — instead of being silently imported wrong.
* Nothing is written to your shop until you press the confirm button.

*Watching the import*

* Live progress bar with a running count and a tail of the change log while the batches run.
* Every create, update, skip and error is written to a change log so you can see exactly what happened and when.
* A reset button clears a stuck import, and an import that stalls for over an hour is cleaned up automatically.

*What lands in your shop*

* A complete WooCommerce product per record: title as artist, title, format and year; cover image; tracklist table; media and sleeve condition; seller notes.
* Genres and styles from Discogs become product categories, so your shop is browsable from day one.
* Stock is set per record and items not marked "For Sale" arrive as drafts, ready for you to review.
* Every product page carries the "Data provided by Discogs" attribution required by the Discogs API terms.

*Staying in control*

* Your own product photos always win: a photo you added yourself is never replaced by a Discogs cover.
* Titles and descriptions you edited by hand survive every re-import — only price, stock, status and categories are refreshed.
* Products that were not created by RecordToko are never touched, even if their SKU happens to match.
* Re-importing the same export is safe: records are matched by SKU (which holds the Discogs listing ID), so you get updates, not duplicates.
* Uninstalling removes everything the plugin stored, including your access token, cached data and the change log table.

*Good to know*

* This version is one-way: RecordToko reads from Discogs and writes to WooCommerce. It never creates, changes or ends listings on Discogs.
* The plugin keeps itself well within Discogs' rate limits and pauses automatically when asked to, so your account stays in good standing.
* Available in English; the interface is fully translatable.

**Discogs API usage and disclaimer**

This application uses Discogs' API but is not affiliated with, sponsored or endorsed by Discogs. 'Discogs' is a trademark of Zink Media, LLC.

As required by the Discogs API terms of service, every product page created or updated by this plugin displays a "Data provided by Discogs" notice linking back to the source release on Discogs. Enrichment data (cover image, tracklist, genres/styles) fetched from Discogs is cached for a maximum of 6 hours before being refreshed. The plugin only ever talks to api.discogs.com — no other third-party or external service is contacted, and the plugin collects and sends no telemetry of any kind.

== External services ==

This plugin connects to the Discogs API (api.discogs.com), a service operated by Zink Media, LLC ("Discogs"). It is required for the plugin's core functionality: importing and enriching your record inventory.

What is sent and when:

* During an import or preview, the plugin sends the release IDs from your inventory to the Discogs API to fetch catalogue data (titles, track lists, genres, cover images).
* If you configure a Discogs personal access token, that token is sent with each API request as authentication.
* If you use the "Fetch from Discogs" option, the plugin requests and downloads your own inventory export from your Discogs account.
* No other data is transmitted. The plugin sends nothing to any other external service and collects no telemetry.

Service information: [Discogs Terms of Service](https://support.discogs.com/hc/en-us/articles/360009334333-Terms-of-Service), [Discogs Privacy Policy](https://support.discogs.com/hc/en-us/articles/360009334513-Privacy-Policy), [Discogs API Terms of Use](https://support.discogs.com/hc/en-us/articles/360009334593-API-Terms-of-Use).

== Installation ==

1. Upload the plugin files to `/wp-content/plugins/recordtoko`, or install the plugin through the WordPress plugins screen directly, then activate it through the "Plugins" screen.
2. Make sure WooCommerce is installed and active — RecordToko adds its screen under the WooCommerce menu.
3. Go to `discogs.com/settings/developers` while logged in to your Discogs account and click "Generate new token" to create a personal access token.
4. In wp-admin, go to WooCommerce → Discogs Sync → Settings, paste the token into the "Access token" field, set your price rule, and save.
5. Go to the Import tab, upload a CSV export (or fetch/download one from Discogs), review the mandatory dry-run preview, and confirm the import when it looks right.

== Frequently Asked Questions ==

= Where do I get a token? =

Go to discogs.com/settings/developers while logged in to your Discogs account and click "Generate new token". Paste the generated token into the Access token field under WooCommerce → Discogs Sync → Settings.

= Is this affiliated with Discogs? =

No. This application uses Discogs' API but is not affiliated with, sponsored or endorsed by Discogs. 'Discogs' is a trademark of Zink Media, LLC.

= Does it sell my data? =

No. The plugin only communicates with api.discogs.com to fetch your own inventory and release data. It sends no telemetry and does not share data with any other third party.

= Does the plugin write anything back to Discogs? =

No. This version is strictly one-way: it only reads from Discogs and writes to your WooCommerce shop. Your Discogs listings are never created, changed or removed.

= What happens to existing products when I re-import? =

Products are matched by SKU, which holds the Discogs listing ID. Price, stock, status and categories are refreshed; the product name, descriptions and any photo you added yourself are left untouched, so your own edits survive every re-import.

= Which file does the CSV upload expect? =

The unmodified inventory export from Discogs (Marketplace - Export inventory). Do not open and re-save it in a spreadsheet first: that can change the price format, which the plugin will refuse loudly rather than import incorrectly.

= Will I run into Discogs rate limits? =

The plugin throttles itself well below the official limits and pauses automatically when Discogs asks it to. Large imports simply take a little longer; adding a personal access token doubles your speed.

= Why is a dry run mandatory? =

Because importing hundreds of records can create or overwrite a lot of products at once, the plugin always shows you a full preview — what will be created, what will be updated, what will be skipped, and any errors — before anything is written to your store. You confirm explicitly before the real import runs.

== Screenshots ==

1. Settings: your Discogs token and the price rule that maps Discogs prices to shop prices.
2. Import: upload a CSV or fetch your inventory straight from Discogs.
3. The mandatory dry-run preview - see exactly what will happen before anything is written.
4. Live progress with a running change log while the import processes in the background.
5. The result: a complete WooCommerce product with cover, condition, tracklist and Discogs attribution.

== Upgrade Notice ==

= 0.1.1 =
Recommended for everyone: prices written with a comma are now refused instead of imported incorrectly, uninstalling removes all stored data including your access token, and products that RecordToko did not create are never touched.

== Changelog ==

= 0.1.1 - 2026-08-25 =
* Strict price validation: comma-decimal prices in a hand-edited CSV are now rejected with a clear error instead of being silently misread.
* Full uninstall cleanup: options (including your Discogs token), cached data and the log table are removed when the plugin is deleted.
* Progress bar shows correct totals immediately after confirming an import.
* Products not created by RecordToko are never overwritten on a SKU collision - they are skipped and logged.
* Clear admin notice when WooCommerce is missing; requires WordPress 6.5+ for the plugin-dependency system.
* Many smaller hardening and polish fixes from a full end-to-end test round.


= 0.1.0 - 2026-08-23 =
* Initial release: CSV and API import, Discogs enrichment, price rules, mandatory dry-run preview, change log.
