Developer Docs
Extend, override and style Discount Rules Box from your own theme or plugin.
Filters
drbu_tier_total
Replace the discount math with your own logic. The filter receives the computed total, base price, quantity, tiers, discount type, tier index and pricing model:
add_filter( 'drbu_tier_total', function ( $total, $base, $qty, $tiers, $discount_type, $tier_index, $pricing_model ) {
// Custom pricing: e.g. apply an extra loyalty discount for members.
return $total * 0.95;
}, 10, 7 );
drbu_pack_discounts_enabled
Disable discounts programmatically (e.g. during flash sales or for specific user roles):
add_filter( 'drbu_pack_discounts_enabled', function ( $enabled ) {
if ( is_user_logged_in() && current_user_can( 'manage_woocommerce' ) ) {
return false; // No discounts for admins.
}
return $enabled;
} );
drbu_enqueue_frontend_assets
Conditionally load (or defer) the frontend CSS/JS. The filter receives a boolean that tells you whether assets are needed on the current page; return false to skip loading them:
add_filter( 'drbu_enqueue_frontend_assets', function ( $needed ) {
// Only load assets on single product pages and the shortcode pages you control.
return is_product() || is_singular( 'page' );
} );
License Hooks
Ready hooks for integrating your own licensing system:
add_filter( 'drbu_license_is_valid', function ( $valid ) {
return my_license_check();
} );
add_filter( 'drbu_license_status', function ( $status ) {
return my_custom_status(); // e.g. 'valid' | 'expired' | 'invalid'
} );
add_action( 'drbu_license_init', function () {
// Initialize your license client.
} );
Template Override
Copy the template into your theme to fully customize the markup:
templates/tiered-buy-box.php → your-theme/woocommerce/tiered-buy-box.php
WordPress template hierarchy picks up the theme version automatically, keeping your changes update-safe.
CSS Selectors
The frontend stylesheet is assets/css/discount-rules-box-upsell-public.css. All selectors are isolated under the .drbu-buy namespace, with legacy .pg-buy fallback classes kept in the markup for themes that styled the previous version.
/* Override from your theme without !important (except functional variant-switching rules) */
.drbu-buy .drbu-cta {
background: #123456;
}
.drbu-buy .drbu-badge-best {
border-radius: 0;
}
Colors set in the admin are injected as CSS variables (--drbu-primary, --drbu-cta-text, --drbu-best-value, --drbu-card-bg…), so you can also restyle through variables.
Enqueue Hook
Assets load through wp_enqueue_style() / wp_enqueue_script() with DRBU_VERSION (minified in production, full when SCRIPT_DEBUG is on). A drbu_enqueue_frontend_assets hook is available to defer or conditionally load assets.
drbu_tier_total filter — both survive plugin updates.