Main Plugin Constants
The main plugin file defines AWECOMMERCE_VERSION:
if (!defined('AWECOMMERCE_VERSION')) {
define('AWECOMMERCE_VERSION', '1.0.0');
}
Activation And Deactivation
Activation and deactivation are handled through the installer:
register_activation_hook(__FILE__, [Installer::class, 'activate']);
register_deactivation_hook(__FILE__, [Installer::class, 'deactivate']);
Activation responsibilities include:
- Running migrations.
- Creating tables.
- Adding capabilities.
- Creating or updating
awc_shop_manager. - Scheduling cron events.
Deactivation responsibilities include:
- Unscheduling queue cron events.
- Leaving commerce data intact.
Lifecycle Hooks
Use lifecycle hooks for integrations:
add_action('awecommerce_loaded', function ($plugin) {
// AweCommerce has loaded and registered integrations.
});
add_action('awecommerce_init', function ($plugin) {
// AweCommerce finished init bootstrap.
});
Plugin Bootstrap Pattern
External plugins should wait for WordPress and AweCommerce before touching AweCommerce services:
add_action('awecommerce_init', function ($plugin) {
if (!class_exists(\AweCommerce\Plugin::class)) {
return;
}
// Register integration behavior here.
});
Guard WordPress Access
Most AweCommerce PHP files begin with:
if (!defined('ABSPATH')) {
exit;
}
Follow the same pattern in integration files that are loaded inside WordPress.
Composer And Runtime Loader
The plugin includes its own lightweight runtime loader and can run without a generated Composer autoloader. Do not assume vendor/autoload.php exists unless your deployment process guarantees it.
Smoke Test Commands
Run targeted smoke checks:
php bin/totals-check.php
php bin/checkout-check.php
php bin/webhook-check.php
php bin/subscription-check.php
php bin/admin-check.php
php bin/api-check.php
php bin/frontend-check.php
php bin/privacy-health-check.php
php bin/tax-coupons-check.php
php bin/queue-check.php
php bin/email-check.php
php bin/invoice-check.php
php bin/portal-check.php
php bin/entitlement-check.php
Run PHP syntax pass:
find . -name '*.php' -not -path './vendor/*' -print0 | xargs -0 -n1 php -l