WP Manifestindependent plugin directory
manifest / ecommerce / shareable-coupons

Shareable Coupons

Links that apply a WooCommerce coupon and land the customer where you choose, each with its own expiry, its own usage limit and a record of the orders it brought in.

by George Vasiliades · github.com/poseidonas/shareable-coupons · website

0stars
1release downloads
0forks

Install

The author publishes release zips, so WP-CLI can install straight from GitHub:

wp plugin install https://github.com/poseidonas/shareable-coupons/releases/download/v1.0.0/shareable-coupons.zip

Declares an update source (https://github.com/Poseidonas/shareable-coupons), so updates arrive through the plugin's own updater.

Readme

Shareable Coupons

Latest release WordPress 6.7+ WooCommerce 9.0+ PHP 8.0+ License GPL-2.0-or-later

Links that apply a WooCommerce coupon and land the customer where you choose. Each link carries its own expiry, its own usage limit and a record of the clicks and orders it brought in, so the same coupon code can run several campaigns at once and you can tell them apart.

  • Author: George Vasiliades - https://github.com/Poseidonas
  • License: GPL-2.0-or-later
  • Requires WordPress 6.7 or newer
  • Requires PHP 8.0 or newer
  • Requires WooCommerce 9.0 or newer, tested up to 11.0
  • Compatible with High-Performance Order Storage and with the cart and checkout blocks
  • Settings live in WooCommerce > Coupon Links

What was measured before writing this

Measured on WooCommerce 11.0.1:

Question Result
Does the core read a coupon from the address? No. There is no $_GET handling for coupons anywhere in WooCommerce
Can a coupon be applied to an empty cart? Yes. WC_Cart::apply_coupon() accepts it and the code survives in the session until items are added
Does the coupon survive between requests? Yes, in applied_coupons on the WooCommerce session
What happens with a code that does not exist? It is refused with a clear notice

The second row is what keeps this plugin small. A visitor can follow a link before they have chosen anything, and the coupon simply waits for them. No queue of pending coupons to invent, and no discount that quietly fails to appear later.

How a link works

You give a coupon code that already exists, a name for your own list, and a key for the address. The result is a link like https://example.com/?coupon=spring.

Following it applies the coupon, optionally puts a product in the cart, and sends the visitor to the cart, the checkout, the shop, the product, or any page you name.

The word in the address is yours to change if coupon clashes with something else on your site.

Expiry and limits belong to the link

A coupon in WooCommerce has its own expiry date and its own usage limits, and those still apply. What this adds is expiry and limits on the link itself.

That distinction is the point of the plugin: one code, SPRING20, can have a newsletter link that ends on the 31st, an Instagram link limited to the first hundred people, and a partner link with no limit at all. The code lives on while a campaign ends.

What it records

Per link: clicks, times the coupon was actually applied, orders placed, and the total value of those orders.

An order is credited to the link the visitor arrived through, recorded on the order itself, and counted once when the order reaches processing or completed. Counting at that point rather than at checkout means an order that never gets paid is not reported as revenue.

The list

Every link with its ready-to-copy address, where it lands, when it ends, how many times it has been used against its limit, and its clicks, orders and value. A link whose coupon has since been deleted is marked, as is one that has ended or reached its limit.

Honest limits

  • A link that has ended or run out still redirects, with a message. It does not 404, because a dead link in a newsletter that lands nowhere is worse than one that explains itself.
  • Clicks count every visit to the address, including repeat visits by the same person and anything else that follows links. Treat them as traffic, not as people.
  • The usage count rises when the coupon is applied to a cart, which is not the same as an order. That is why orders are counted separately.
  • Order tracking follows the WooCommerce session. A visitor who follows the link in one browser and orders in another is not connected, and neither is one who blocks cookies.
  • The plugin never creates or edits coupons. It refuses to save a link whose coupon does not exist, so a broken link is not handed out, but a coupon deleted afterwards is only flagged in the list.
  • Adding a product happens only if the product is purchasable and in stock.

Filters

add_filter( 'icxcnika_sc_links', function ( array $links ): array {
    return $links;
} );

add_filter( 'icxcnika_sc_settings', function ( array $settings ): array {
    return $settings;
} );

icxcnika_sc_links receives the links with their counters and is the last word on what exists. icxcnika_sc_registry_payload receives the data sent to the installation registry.

Data stored

  • Option icxcnika_sc_links (the links and their counters).
  • Option icxcnika_sc_settings (the behaviour).
  • Order meta _icxcnika_sc_link (the link the order came from) and _icxcnika_sc_counted (so an order is counted once). Both stay on orders at uninstall, because orders are deliberately left untouched.
  • Option icxcnika_sc_registry_key (random installation key of 48 characters, created only if installation reporting is active).
  • Transient icxcnika_sc_release (cached GitHub release lookup, 12 hours).
  • Cron event icxcnika_sc_registry_ping (weekly, only if installation reporting is active).

Installation reporting

On activation, on deactivation and once a week the plugin sends a small JSON message to the author's installation registry: plugin slug, plugin version, home URL, site URL, WordPress version, WooCommerce version, PHP version, locale and whether the site is a multisite. Each report carries a random installation key generated locally on first use. No coupon, order or customer data is ever sent.

The reporting address is empty by default, which means nothing is sent at all. Add define( 'ICXCNIKA_REGISTRY_DISABLE', true ); to wp-config.php to turn the reporting off, or define( 'ICXCNIKA_REGISTRY_URL', '...' ); to point it elsewhere.

Updates

Updates are delivered from GitHub Releases through the Update URI header of WordPress. The Plugins screen shows View details and allows automatic updates to be enabled, exactly as for a plugin from the directory.

Uninstall

Deleting the plugin removes both options, the installation key, the cached release check and the scheduled report. Coupons and orders are left exactly as they were.


Shareable Coupons (Ελληνικά)

Σύνδεσμοι που εφαρμόζουν κουπόνι WooCommerce και οδηγούν τον πελάτη όπου επιλέγετε. Κάθε σύνδεσμος φέρει δική του λήξη, δικό του όριο χρήσεων και καταγραφή των κλικ και των παραγγελιών που έφερε, ώστε ο ίδιος κωδικός κουπονιού να τρέχει πολλές καμπάνιες ταυτόχρονα και να τις ξεχωρίζετε.

  • Δημιουργός: George Vasiliades - https://github.com/Poseidonas
  • Άδεια: GPL-2.0-or-later
  • Απαιτεί WordPress 6.7 ή νεότερο
  • Απαιτεί PHP 8.0 ή νεότερη
  • Απαιτεί WooCommerce 9.0 ή νεότερο, δοκιμασμένο έως 11.0
  • Συμβατό με το High-Performance Order Storage και με τα μπλοκ καλαθιού και ταμείου
  • Οι ρυθμίσεις βρίσκονται στο WooCommerce > Σύνδεσμοι κουπονιών

Τι μετρήθηκε πριν γραφτεί

Μετρήθηκε σε WooCommerce 11.0.1:

Ερώτημα Αποτέλεσμα
Διαβάζει ο πυρήνας κουπόνι από τη διεύθυνση; Όχι. Δεν υπάρχει πουθενά στο WooCommerce χειρισμός $_GET για κουπόνια
Μπορεί να εφαρμοστεί κουπόνι σε άδειο καλάθι; Ναι. Το WC_Cart::apply_coupon() το δέχεται και ο κωδικός επιβιώνει στη συνεδρία μέχρι να μπουν είδη
Επιβιώνει το κουπόνι ανάμεσα σε αιτήματα; Ναι, στο applied_coupons της συνεδρίας του WooCommerce
Τι γίνεται με κωδικό που δεν υπάρχει; Απορρίπτεται με σαφές μήνυμα

Η δεύτερη γραμμή είναι που κρατά αυτό το πρόσθετο μικρό. Ένας επισκέπτης μπορεί να ακολουθήσει τον σύνδεσμο πριν διαλέξει οτιδήποτε, και το κουπόνι απλώς τον περιμένει. Δεν χρειάζεται να επινοηθεί ουρά κουπονιών σε αναμονή, ούτε υπάρχει έκπτωση που αποτυγχάνει σιωπηλά αργότερα.

Πώς λειτουργεί ένας σύνδεσμος

Δίνετε κωδικό κουπονιού που υπάρχει ήδη, ένα όνομα για τη δική σας λίστα, και ένα κλειδί για τη διεύθυνση. Το αποτέλεσμα είναι σύνδεσμος σαν τον https://example.com/?coupon=spring.

Ακολουθώντας τον, εφαρμόζεται το κουπόνι, προαιρετικά μπαίνει ένα προϊόν στο καλάθι, και ο επισκέπτης οδηγείται στο καλάθι, στο ταμείο, στο κατάστημα, στο προϊόν, ή σε όποια σελίδα ορίσετε.

Η λέξη στη διεύθυνση αλλάζει, αν το coupon συγκρούεται με κάτι άλλο στον ιστότοπό σας.

Η λήξη και τα όρια ανήκουν στον σύνδεσμο

Ένα κουπόνι στο WooCommerce έχει δική του ημερομηνία λήξης και δικά του όρια χρήσης, και αυτά εξακολουθούν να ισχύουν. Αυτό που προστίθεται εδώ είναι λήξη και όρια στον ίδιο τον σύνδεσμο.

Αυτή η διάκριση είναι το νόημα του πρόσθετου: ένας κωδικός, ο SPRING20, μπορεί να έχει σύνδεσμο newsletter που λήγει στις 31, σύνδεσμο Instagram περιορισμένο στους πρώτους εκατό, και σύνδεσμο συνεργάτη χωρίς κανένα όριο. Ο κωδικός συνεχίζει να ζει ενώ μια καμπάνια τελειώνει.

Τι καταγράφει

Ανά σύνδεσμο: κλικ, φορές που εφαρμόστηκε πραγματικά το κουπόνι, παραγγελίες, και συνολική αξία αυτών των παραγγελιών.

Μια παραγγελία πιστώνεται στον σύνδεσμο από τον οποίο ήρθε ο επισκέπτης, καταγράφεται πάνω στην ίδια την παραγγελία, και μετράει μία φορά όταν η παραγγελία φτάσει σε επεξεργασία ή ολοκλήρωση. Η μέτρηση σε εκείνο το σημείο και όχι στο ταμείο σημαίνει ότι μια παραγγελία που δεν πληρώνεται ποτέ δεν αναφέρεται ως έσοδο.

Ο πίνακας

Κάθε σύνδεσμος με έτοιμη προς αντιγραφή διεύθυνση, πού οδηγεί, πότε λήγει, πόσες φορές χρησιμοποιήθηκε σε σχέση με το όριό του, και τα κλικ, τις παραγγελίες και την αξία του. Σύνδεσμος του οποίου το κουπόνι διαγράφηκε στο μεταξύ σημειώνεται, όπως και ένας που έληξε ή έφτασε το όριό του.

Τίμιοι περιορισμοί

  • Σύνδεσμος που έληξε ή εξαντλήθηκε εξακολουθεί να ανακατευθύνει, με μήνυμα. Δεν βγάζει 404, γιατί ένας νεκρός σύνδεσμος σε newsletter που δεν οδηγεί πουθενά είναι χειρότερος από έναν που εξηγείται.
  • Τα κλικ μετρούν κάθε επίσκεψη στη διεύθυνση, μαζί με τις επαναλαμβανόμενες από το ίδιο άτομο και ό,τι άλλο ακολουθεί συνδέσμους. Θεωρήστε τα κίνηση, όχι ανθρώπους.
  • Ο μετρητής χρήσεων ανεβαίνει όταν το κουπόνι εφαρμόζεται σε καλάθι, που δεν είναι το ίδιο με παραγγελία. Γι' αυτό οι παραγγελίες μετριούνται ξεχωριστά.
  • Η καταγραφή παραγγελιών ακολουθεί τη συνεδρία του WooCommerce. Επισκέπτης που ακολουθεί τον σύνδεσμο σε έναν browser και παραγγέλνει σε άλλον δεν συνδέεται, ούτε κάποιος που μπλοκάρει cookies.
  • Το πρόσθετο δεν δημιουργεί ούτε επεξεργάζεται κουπόνια. Αρνείται να αποθηκεύσει σύνδεσμο του οποίου το κουπόνι δεν υπάρχει, ώστε να μη μοιραστεί χαλασμένος σύνδεσμος, αλλά κουπόνι που διαγράφεται αργότερα απλώς σημειώνεται στη λίστα.
  • Η προσθήκη προϊόντος γίνεται μόνο αν το προϊόν είναι αγοράσιμο και σε απόθεμα.

Φίλτρα

add_filter( 'icxcnika_sc_links', function ( array $links ): array {
    return $links;
} );

add_filter( 'icxcnika_sc_settings', function ( array $settings ): array {
    return $settings;
} );

Το icxcnika_sc_links δέχεται τους συνδέσμους με τους μετρητές τους και έχει τον τελευταίο λόγο για το τι υπάρχει. Το icxcnika_sc_registry_payload δέχεται τα δεδομένα που στέλνονται στο μητρώο εγκαταστάσεων.

Δεδομένα που αποθηκεύονται

  • Option icxcnika_sc_links (οι σύνδεσμοι και οι μετρητές τους).
  • Option icxcnika_sc_settings (η συμπεριφορά).
  • Order meta _icxcnika_sc_link (ο σύνδεσμος από τον οποίο ήρθε η παραγγελία) και _icxcnika_sc_counted (ώστε κάθε παραγγελία να μετρηθεί μία φορά). Και τα δύο μένουν στις παραγγελίες κατά την απεγκατάσταση, επειδή οι παραγγελίες σκόπιμα δεν αγγίζονται.
  • Option icxcnika_sc_registry_key (τυχαίο κλειδί εγκατάστασης 48 χαρακτήρων, δημιουργείται μόνο αν είναι ενεργή η αναφορά εγκατάστασης).
  • Transient icxcnika_sc_release (cache της αναζήτησης έκδοσης στο GitHub, 12 ώρες).
  • Cron event icxcnika_sc_registry_ping (εβδομαδιαίο, μόνο αν είναι ενεργή η αναφορά εγκατάστασης).

Αναφορά εγκατάστασης

Κατά την ενεργοποίηση, την απενεργοποίηση και μία φορά την εβδομάδα το πρόσθετο στέλνει ένα μικρό μήνυμα JSON στο μητρώο εγκαταστάσεων του δημιουργού: slug και έκδοση του πρόσθετου, home URL, site URL, έκδοση WordPress, έκδοση WooCommerce, έκδοση PHP, γλώσσα και αν το site είναι multisite. Κάθε αναφορά συνοδεύεται από ένα τυχαίο κλειδί εγκατάστασης που δημιουργείται τοπικά την πρώτη φορά. Δεδομένα κουπονιών, παραγγελιών ή πελατών δεν στέλνονται ποτέ.

Η διεύθυνση αναφοράς είναι κενή από προεπιλογή, που σημαίνει ότι δεν αποστέλλεται τίποτα. Προσθέστε define( 'ICXCNIKA_REGISTRY_DISABLE', true ); στο wp-config.php για να απενεργοποιήσετε την αναφορά, ή define( 'ICXCNIKA_REGISTRY_URL', '...' ); για να τη στείλετε αλλού.

Ενημερώσεις

Οι ενημερώσεις παραδίδονται από τα GitHub Releases μέσω της κεφαλίδας Update URI του WordPress. Η οθόνη Πρόσθετα δείχνει Προβολή λεπτομερειών και επιτρέπει την ενεργοποίηση αυτόματων ενημερώσεων, ακριβώς όπως για πρόσθετο του καταλόγου.

Απεγκατάσταση

Η διαγραφή του πρόσθετου αφαιρεί και τα δύο options, το κλειδί εγκατάστασης, τον αποθηκευμένο έλεγχο έκδοσης και το προγραμματισμένο ραντεβού. Τα κουπόνια και οι παραγγελίες μένουν ακριβώς όπως ήταν.

Read the full README on GitHub →

Releases

TagPublishedAssetDownloads
v1.0.0 Aug 19, 2026 shareable-coupons.zip 1