Version 8.1.0 – Commission Tweaks, Store Credit Fixes, And More Improvements

Version 8.1.0 of Coupon Affiliates is now available!

This release is mostly about accuracy. It fixes a number of long-standing quirks in how commission is calculated, offers improvements to applying store credit on the WooCommerce block checkout, sorts out payout methods disappearing from the affiliate dashboard, and makes statistics rebuilds much faster and more reliable.

Adjusting commission after a refund

When you refund part of an order, Coupon Affiliates normally adjusts the affiliate’s commission for you.

There’s one type of refund it could never see though: an amount-only refund, where you type a total into the refund box without picking which products it applies to. With no products to work from there’s nothing for the plugin to recalculate, so the commission stayed as it was.

The “Coupon Affiliate” box on the order edit screen now catches this.

If the commission already given to an affiliate is higher than what the order currently works out to, it’s flagged on the order along with a one-click Deduct link. Click it and the difference comes off the affiliate’s unpaid commission balance, and the order’s recorded commission is brought up to date.

More accurate commission calculations

Several calculation bugs have been fixed in this release:

  • Decimal commission rates now work properly. Product and category commission percentages entered as a decimal were rounded down to a whole number. This is now fixed.
  • Taxes are no longer added multiple times to fixed commission. With “Include taxes in fixed commission calculations” enabled, the tax was added once for every product in the order instead of once in total. This is now fixed.
  • Custom discounts and store credit are deducted more fairly. These order-level discounts were always deducted at the coupon’s commission rate, even when the products in the order earned a lower per-product rate. That could over-deduct, and in some cases produce a negative commission. They’re now deducted at the rate actually earned across the order, with a new setting (enabled by default) if you’d prefer the old behaviour.
  • Commission can never be negative. Large custom discounts or store credit could result in a negative commission being saved to the order and shown in your new order email. It’s now floored at zero.

Excluding products your coupon doesn’t apply to

By default, Coupon Affiliates pays commission on every product in a referred order.

The affiliate brought you the sale, regardless of which items the discount happened to apply to. That’s the right behaviour for most stores and it hasn’t changed.

Some stores need the opposite though. If you sell bundles or kits made up of individually priced items, or you have products that should never earn commission, you can now switch on “Exclude products the coupon does not apply to from commission” in Settings > Commission > Advanced Calculation Settings.

With it enabled, your coupon’s own WooCommerce “Usage restriction” settings decide what earns commission: Products, Exclude products, Product categories, Exclude categories, and Exclude sale items.

Anything the coupon can’t be used on earns nothing, percentage or fixed. Category restrictions include sub-categories, exactly as WooCommerce applies them itself.

The option is off by default, so nothing changes unless you turn it on.

Store credit now works on the new WooCommerce checkout

If your store uses WooCommerce’s Cart and Checkout Blocks, which is the default for any store set up in the last couple of years, your affiliates had no way to actually spend their store credit.

The redemption option only appeared properly on the older shortcode-based cart and checkout, so the balance was visible on their dashboard but unusable at checkout.

It now shows on both. The checkbox also saves your choice more reliably – previously it was only saved on requests where the cart totals were recalculated, which could make it feel unresponsive.

We also fixed an issue where the store credit option could disappear from the cart and checkout entirely if the “Wallet System” setting had been saved without a selection, even though store credit still showed as enabled everywhere in the admin area.

And while we were there, the plugin now formally declares compatibility with Cart and Checkout Blocks, so it’s no longer listed as incompatible in the block editor.

Payout methods disappearing from the dashboard

Some affiliates were seeing “No payout methods are available currently” on their dashboard, with nothing in the settings to explain why. This turned out to be several separate issues stacking on top of each other, and they’re all fixed in 8.1.0:

  • Saving an affiliate group no longer breaks other payout methods. Saving a group used to rewrite the role limit on every payout method, including ones that weren’t shown on that page because they were disabled at the time. Enabling such a method later left it unavailable for that group, and any group you created afterwards was locked out of it too. Group settings are now stored per-group, and only the methods actually shown on the page are changed when you save it. Existing limits are converted automatically when you update, so groups that were deliberately excluded stay excluded.
  • A role limit can no longer be applied invisibly. In the Payouts settings, the “Limit to certain user roles & groups?” option could be switched on and applied while being completely invisible on the page. The switch is now always shown, and turning it off clears the limit.
  • The Payouts settings now tell you when a group has a method turned off, with a link to change it. Previously there was nothing to indicate a group-level limit existed at all.
  • The “Payout Methods” column on the Groups page showed the wrong methods for every group whenever a payout method had a role limit set.
  • Wise Bank Transfer group limits now work. Limiting Wise to certain groups had no effect at all, and Wise never appeared in the payout methods list on the “Edit Affiliate Group” page in the first place.
  • Custom Payment Methods #1 and #2 now have the same “Limit to certain user roles & groups?” option as every other payout method.
  • Viewing an affiliate’s dashboard as an admin now shows their available payout methods rather than the ones available to your own user role.

Faster, more reliable statistics

Statistics rebuilds have had a big overhaul in this release.

They’re a lot faster. Rebuilds used to work through a coupon’s history 20 days at a time, so a coupon spanning several years took over a hundred requests, most of them covering days with no orders at all, and could time out entirely. They’re now split into batches by number of orders instead, so quiet periods are skipped and even a long history finishes in a handful of requests.

Each order’s data is loaded once per batch rather than re-queried for every value, and the object cache is no longer switched off while orders are processed. The “Batch size” option under Settings > Debug is now the number of orders per request.

They also no longer get stuck. Some affiliate dashboards could end up permanently on “Calculating statistics…”, with Total Sales and Total Commission showing only “…” in the admin. A coupon’s saved statistics were deleted before the rebuild started and only written back at the very end, so if the rebuild didn’t finish (a request timing out, or the affiliate closing the page) the coupon was left with no statistics at all, which triggered another full rebuild on the next page load, indefinitely.

Statistics are now kept in place until a rebuild has completed, an interrupted rebuild carries on from where it left off, failed requests are retried before giving up, and a coupon with usage but no countable orders no longer rebuilds on every load.

Two related fixes came out of the same work:

  • “Processing Commission” is no longer reset to zero at the start of a rebuild, so an interrupted rebuild can’t leave an affiliate showing 0.00. With pending commission turned off (and in the free version) the stored value is left alone entirely, where previously just loading a dashboard could wipe a manually entered amount.
  • “Latest Referrals” on the Statistics tab only searched the last 90 days, so an affiliate whose most recent orders were older than that saw fewer than 5 referrals, often none at all, while the Recent Orders tab listed them correctly. It now looks across the full history.

Other new additions

A few smaller additions:

  • A new option in the Fraud Prevention settings to withhold commission when an affiliate uses their own coupon.
  • A “Performance Bonuses” section in the Design settings, to customise the colours of the bonuses progress bar and the reward summary box on the affiliate dashboard.
  • Nouveau {firstname} et {lastname} merge tags for the “New Payout Request” and “New Commission Payout” emails.
  • The affiliate email reports now have an “Email Greeting Text” option, with merge tags for first name, last name, display name and username. Previously it always used the affiliate’s display name.
  • On the edit user screen, the “Store Credit Balance” field has moved out of the payment settings into its own section, so it’s always visible regardless of which payout method the affiliate has selected.
  • The admin notification bell has been optimised, and now opens instantly on the first click instead of often doing nothing until you clicked it again.

Changelog complet

  • New: (PRO) The “Coupon Affiliate” box on the order edit screen now flags when the commission already granted to an affiliate is higher than the current calculated commission for the order (for example, after a partial refund), with a one-click “Deduct” link that removes the difference from the affiliate’s unpaid commission balance and updates the granted amount for the order. This also detects refunds that were not allocated to specific line items (amount-only refunds), which the automatic recalculation cannot see.
  • New: (PRO) Added a “Performance Bonuses” section to the “Design” settings tab (shown when performance bonuses are enabled) to customise the colours of the bonuses progress bar (bar and background) and the reward summary box (background and text) on the affiliate dashboard.
  • New: Added an option to the “Fraud Prevention” settings to not give commission to affiliates that use their own code.
  • New: (PRO) Added {firstname} and {lastname} merge tags to the “Payouts Emails” settings, so the affiliate’s first and last name can be included in the “New Payout Request” and “New Commission Payout” emails.
  • New: (PRO) Added an “Email Greeting Text” option to the “Affiliate Email Reports” > “Report Customisation” settings to customise the greeting at the top of the report email, with {first_name}, {last_name}, {display_name} and {username} merge tags (previously always the affiliate’s display name).
  • New: Added an “Exclude products the coupon does not apply to from commission” option to “Advanced Calculation Settings” (Settings > Commission). When enabled, products excluded by the coupon’s own WooCommerce “Usage restriction” settings – “Products”, “Exclude products”, “Product categories”, “Exclude categories” and “Exclude sale items” – earn no commission, neither percentage nor fixed. Category restrictions include sub-categories, matching how WooCommerce itself applies them. This is useful where certain products should never be commissionable, such as bundles or kits built from individually priced items. It is disabled by default, leaving the existing behaviour unchanged: commission is calculated on every product in the order, because the affiliate referred the sale regardless of which items the discount applied to.
  • Tweak: (PRO) On the edit user screen (and the “View Affiliate” page “Edit User” tab), the “Store Credit Balance” field has been moved out of the payment settings into its own “Store Credit” section below it, so it is always visible regardless of the affiliate’s selected payout method.
  • Tweak: (PRO) The plugin now declares compatibility with the WooCommerce “Cart and Checkout Blocks” feature, so it is no longer listed as incompatible in the block editor.
  • Tweak: (PRO) The “Custom Payment Method” #1 and #2 payout methods now have the same “Limit to certain user roles & groups?” option as the other payout methods, so a limit applied to them from an affiliate group can also be seen and changed in the settings.
  • Tweak: (PRO) Payout method role/group limits on the affiliate dashboard are now checked against the affiliate whose dashboard is being shown, instead of the logged-in user. Previously an admin viewing an affiliate’s dashboard was shown the payout methods available to their own user role.
  • Tweak: Statistics rebuilds are considerably faster and no longer time out on coupons with a long history. They are now split into batches by number of orders instead of 20 days at a time, so days with no orders are skipped and a coupon spanning several years finishes in a handful of requests rather than over a hundred; each order’s saved data is loaded once per batch instead of re-queried for every value; and the object cache is no longer switched off while orders are processed (which had prevented WordPress from caching that data at all). The “Batch size” option (Settings > Debug) is now the number of orders per request, and the order statuses and date column used to size the work now match those the calculation actually counts – previously a single old cancelled order could add years of empty batches.
  • Tweak: (PRO) The store credit redemption option now shows on the WooCommerce Cart and Checkout blocks. It previously only appeared on the shortcode based cart and checkout, so on block based checkouts (the default for newer stores) affiliates had no way to apply their store credit balance to an order.
  • Tweak: (PRO) The store credit checkbox at the cart and checkout now saves your choice more reliably. Previously the choice was only saved on requests where the cart totals were recalculated, which could leave the checkbox unresponsive.
  • Tweak: Affiliate commission can no longer be recorded as a negative amount. Large custom discounts or store credit could previously cause a negative commission to be saved to the order and shown in the admin new order email; the commission is now floored at zero before it is stored.
  • Tweak: Optimised the notifications bell in the admin header, which now also opens instantly on the first click showing the latest notifications, instead of often doing nothing until it was clicked again.
  • Tweak: (PRO) The store credit checkbox at the cart and checkout is now protected with a security nonce.
  • Tweak: (PRO) The product commission rates table now verifies a request token tied to the specific coupon it was shown for.
  • Tweak: (PRO) Corrected the multi-level affiliate relationship check used by the dashboard statistics and statistics refresh requests, which was being tested the wrong way round.
  • Tweak: (PRO) Removed an unused leftover template file that loaded WordPress directly and could be requested by anyone.
  • Fix: (PRO) Fixed an issue where the store credit option could stop appearing at the cart and checkout entirely if the “Wallet System” setting had been saved without a selection, even though store credit still showed as enabled throughout the admin area. An empty selection is now treated as the built-in store credit system.
  • Fix: (PRO) Corrected how custom discounts and store credit reduce percentage commission when an order contains products on different commission rates. Previously these order-level discounts were always deducted at the coupon’s commission rate, which could over-deduct – and even produce a negative commission – when the products actually earned a lower per-product rate. They are now deducted at the blended rate actually earned across the order’s products. This is controlled by a new “Deduct custom discounts & store credit at each order’s blended commission rate” setting (Settings > Commission > Advanced Calculation Settings, enabled by default); disable it to revert to the previous behaviour of always deducting at the coupon rate.
  • Fix: Fixed an issue with “Include taxes in fixed commission calculations” enabled, where tax was added to the fixed commission amounts once for every line item in the order instead of once in total, so it compounded on orders containing more than one product.
  • Fix: (PRO) Product and category commission percentages entered as a decimal were rounded down to a whole number when commission was calculated, so a product set to 2.5% paid only 2%, and a rate below 1% paid nothing at all. The rate entered in the settings is now used in full.
  • Fix: (PRO) Fixed payout methods disappearing from the affiliate dashboard (“No payout methods are available currently”) with nothing in the settings to show why. Saving an affiliate group rewrote the role limit of every payout method – including methods that were not shown on that page because they were disabled at the time – to “all of the user roles that exist right now, except this group”. Enabling such a payout method later left it unavailable for that group, and any group created afterwards was locked out of it as well. A group’s payout methods are now stored as an exclusion for that group alone, only the methods actually shown on the “Edit Affiliate Group” page are changed when it is saved, and groups created later are no longer affected. Existing limits are converted automatically when updating, so groups that were excluded from a payout method stay excluded (you can re-enable a method for a group by ticking it on its “Edit Affiliate Group” page).
  • Fix: (PRO) The “Limit to certain user roles & groups?” option in the “Payouts” settings could be applied while being completely invisible – the roles list was hidden because the option was switched off, while the switch itself was hidden because roles were selected, leaving nothing on the page but the label. The switch is now always shown, and switching it off clears the selected roles so a limit can never be left applied by checkboxes that are not visible.
  • Fix: (PRO) The “Payouts” settings now list any groups that have a payout method turned off on the “Groups” page, with a link to change it. Previously nothing in the payout method settings showed that a group level limit existed.
  • Fix: (PRO) The “Payout Methods” column on the “Groups” page showed the wrong payout methods for every group whenever a payout method had a role limit set, because it compared the group against the wrong part of the setting.
  • Fix: (PRO) Limiting the “Wise Bank Transfer” payout method to certain groups had no effect, because the “Edit Affiliate Group” page saved it under a different setting name to the one used by the affiliate dashboard and the payouts settings. Wise Bank Transfer also never appeared in the payout methods list on the “Edit Affiliate Group” page.
  • Fix: Affiliate dashboards could become permanently stuck on “Calculating statistics…”, with “Total Sales” and “Total Commission” showing only “…” in the admin. A coupon’s saved statistics were deleted before the rebuild started and only written back at the very end, so a rebuild that did not finish (a request timing out, or the affiliate closing the page) left the coupon with no statistics at all – which triggered another full rebuild on the next page load, indefinitely. Statistics are now kept in place until a rebuild has completed, an interrupted rebuild carries on from where it stopped, a failed request is retried before giving up, and a coupon with recorded usage but no countable orders (all cancelled, or placed before its start date) no longer rebuilds on every single load.
  • Fix: (PRO) The “Processing Commission” total is no longer set to zero at the start of a statistics rebuild. It is rebuilt separately and only replaces the stored value once the rebuild has completed, so an interrupted rebuild can no longer leave an affiliate showing 0.00. With pending commission turned off (and in the free version) the stored value is now left untouched, where previously loading a dashboard could clear a manually entered amount.
  • Fix: The “Latest Referrals” summary on the “Statistics” tab only searched the last 90 days, so an affiliate whose most recent orders were further back than that saw fewer than 5 referrals – often none at all – while the “Recent Orders” tab listed them correctly. It now looks across the full history; the query is capped by a row limit, so this does not depend on how many orders a coupon has.
  • Fix: (PRO) Fixed a “wpdb::prepare() must have a placeholder” notice appearing in the debug log, from the one-time migration that encrypts existing Wise bank details.
  • Fix: (PRO) Searching or changing page on the product commission rates table no longer switches it to the default commission rates when the “Show search box” option is turned off. The coupon was read from the search form, so with the form hidden it was sent empty and the table came back showing the default rates instead of the affiliate’s.
  • Fix: (PRO) The product commission rates table now shows the default rates when it is used without a coupon (the [couponaffiliates-rates] shortcode with no “coupon” set). It previously fell back to the individual commission rates of the author of the page the shortcode was placed on.
  • Fix: (PRO) The [couponaffiliates-rates] shortcode now works with coupon codes that contain characters such as “&”. The code was being escaped before it was looked up, so it matched no coupon and the table quietly showed the default commission rates instead of that affiliate’s.
  • Fix: (PRO) The information icon next to a payout method on the affiliate dashboard’s “Commission Payouts” tab showed no tooltip when hovered over, so the payout details recorded for that payment could not be read.

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *