■ Custom WordPress Plugin Development
wp-content/mu-plugins/inspirelle-typeb-autocoupon.php
v1.2.0
<?php
/**
* Plugin Name: INSPIRELLE Type-B Auto-Coupon
* Description: Auto-applies pre-issued store credit on renewal checkout.
* Author: Appycodes (https://appycodes.dev)
* Version: 1.2.0
* Requires: WooCommerce 8.x, WC Subscriptions 6.x
*/
namespace Appycodes\Inspirelle\TypeBAutocoupon;
if ( ! defined( 'ABSPATH' ) ) { exit; }
// idempotent · per-session dedup · silent on failure · 0-order edge case handled
add_action( 'woocommerce_before_checkout_form', __NAMESPACE__ . '\\maybe_apply', 20 );
function maybe_apply(): void {
// ...
}
■ Talk to the lead architect
Ritesh Agarwal · Lead Architect, Appycodes · LinkedIn
■ What you get
01
One feature, one integration, one bug — done as a proper plugin or mu-plugin. Namespaced, idempotent, in version control.
02
Pricing rules, role-based access, custom shipping logic, gateway extensions, subscription extensions, ACF-driven inventory.
03
Zoho, Salesforce, HubSpot, custom APIs — written as plugins with proper hook architecture and error handling.
04
Version control + CI deploy pipelines. So plugins don't live in production cPanel forever, fixed by SSH and forgotten.
05
Taking over a plugin built by another team. Making it stable, idempotent, version-controlled, and predictable.
06
.org repo or private GitHub releases when the project requires distribution. SVN dance handled.
■ Evidence — three plugins, three shapes
mu-plugin · stateful · 0-order edge case
Auto-applies a customer's pre-issued store-credit coupon on the renewal checkout. Email-restricted (only applies if the cart customer's email matches the coupon restriction), per-session deduplicated (won't keep re-applying after the customer removes it manually), silent on failure (no scary red notices), and overrides WooCommerce's default coupon notice with a branded message.
0-order edge case explicitly handled (where store credit fully covers the renewal — gateways behave differently). Per-session reset between browser sessions so a returning customer gets it again tomorrow.
// branded override
add_filter( 'woocommerce_coupon_message',
function ( $msg, $msg_code, $coupon ) {
if ( 'inspirelle_typeb' !== $coupon->get_code() ) return $msg;
$amt = number_format( (float) $coupon->get_amount(), 2 );
return "Your INSPIRELLE store credit of {$amt} has been applied to this renewal.";
}, 10, 3
);Plugin · namespaced · idempotent · dry-run-able
A WordPress plugin in the Appycodes\LocalizeLinks namespace that walks posts and rewrites internal links per locale, storing the localized content in per-locale postmeta (blog_content_{locale}).
Idempotent — skips posts where the target meta is already populated, unless --force is set. Dry-run mode surfaces what would change without writing. Per-link diff output logged. Filter hook (appycodes_localize_links_meta_key) so the meta key template is customisable per project. Action hook (appycodes_localize_links_before_post) so other plugins can extend.
# WP-CLI usage wp localize-links run --locale=fr --dry-run wp localize-links run --locale=fr # writes wp localize-links run --locale=fr --force # re-writes existing
WooCommerce extension · ACF-driven · bug-fixed
WooCommerce extension for a garment store: ACF-driven per-size stock fields (XS / S / M / L / XL / XXL) summed to set total WC stock. Per-size add-to-cart validation reads the selected size from addon-* POST keys (because the site uses WooCommerce Product Add-ons). Stock reduction on order status change to processing / completed, guarded by a _appy_size_stock_reduced order meta flag for idempotency. Stock restoration on cancellation / refund.
Real bug we caught and fixed: the existing function had an if ($total_stock > 0) guard that prevented stock from updating to zero when all sizes sold out, leaving the product listed as in-stock when it wasn't. Removed the guard and properly set _manage_stock and _stock_status.
// BEFORE — bug
if ( $total_stock > 0 ) { // never updates to zero
update_post_meta( $id, '_stock', $total_stock );
}
// AFTER — fixed
update_post_meta( $id, '_stock', max(0, $total_stock) );
update_post_meta( $id, '_manage_stock', 'yes' );
update_post_meta( $id, '_stock_status',
$total_stock > 0 ? 'instock' : 'outofstock' );Pair with custom WordPress, WooCommerce, and subscriptions engineering. Integration-heavy plugins ride alongside API & integration work.
▼ The Plugin-vs-functions.php Decision Box
X-axis: lines of code. Y-axis: state / complexity. Each quadrant is what the right shape looks like.
Low LOC · medium state
Add a custom dashboard widget, wp-cli command
High LOC · stateful
WooCommerce extension, third-party integration, custom CPT engine
Low LOC · stateless
Conditional class on body, hook the_content once
Medium LOC · site-specific, must-not-deactivate
INSPIRELLE auto-coupon, security headers, multisite-wide behaviour
■ Good fit if
■ Probably not a fit
■ How we ship plugins
■ One feature, done right
■ Other services
Explore the rest of what we build.
MVP to production builds, multi-tenant, billing, AI features.
Learn moreiOS + Android in one codebase. Push, offline, OTA updates.
Learn moreConvert your Lovable / Claude / Bolt web app to React Native or Flutter — backend reused.
Learn morePrerender, schema, Core Web Vitals — engineering-led SEO.
Learn moreB2B marketplaces, membership sites, headless WordPress.
Learn moreCustom themes, migration to Shopify, Shopify apps, supplier-feed automation.
Learn moreB2B wholesale, high-SKU catalogues, WooCommerce Subscriptions, Shopify-to-Woo migrations.
Learn morePost-launch stability, security, monthly improvements.
Learn moreTake an AI-built prototype to a production-ready product.
Learn moreConvert AI-built web prototypes into native mobile apps.
Learn moreSubmit, configure and optimise for App Store + Play Store.
Learn moreModernise legacy systems with zero-downtime migrations.
Learn moreEngineering capacity for agencies, under your brand.
Learn moreFrom idea to live product — design, build, launch, growth.
Learn moreCustom REST/GraphQL APIs and third-party integrations.
Learn moreMulti-tenant AI SaaS with subscriptions and admin dashboards.
Learn moreMarketplaces with credit, KYC, and trust infrastructure baked in.
Learn moreCustomised Moodle deployments and bespoke Moodle mobile apps.
Learn moreSubscription recovery, dunning, migrations, combinatorial billing matrices.
Learn moreMagento, WordPress, BigCommerce → Shopify. Redirect-engineering first.
Learn moreForensic incident response — Magecart, backdoors, DDoS, GDPR Art. 33.
Learn moreFour production Laravel platforms. ERPs, contracts, tendering.
Learn moreWebhooks, metering, proration, dunning, multi-currency, reconciliation.
Learn moreWorkers, R2, WAF, Bulk Redirects. The full surface, not just the orange cloud.
Learn moreTender automation, contract operations, compliance calendars, calculators.
Learn moreRLS, multi-role auth, production-hardening Lovable / Bolt / v0 prototypes.
Learn moreWP + Next.js with preview, ISR, auth handoff, media pipeline, search.
Learn moreSchema-first builds, multilingual setups, migrations from WP / Contentful / Strapi.
Learn moreFour production Vue platforms. Vue + Laravel as the default pairing.
Learn morenginx, PHP-FPM, slow-query analysis, plugin audit. Diagnostic engineering, not plugin installs.
Learn moreKB + forum + adjacent surfaces. Search, version-aware routing, role-based visibility.
Learn moreMulti-day festivals, white-label venue groups, offline-capable door-staff apps.
Learn moreProduction RAG with chunking, hybrid retrieval, reranking, grounding, eval.
Learn moreMake.com, n8n, Zapier, and custom Node workers — chosen by volume.
Learn moreCalculator- and location-driven SEO surfaces with real data and SSR.
Learn moreDRF APIs for field-ops at scale — pan-India last-mile delivery for microfinance.
Learn more