set( 'cart.fee_applier', static fn( Container $c ): FeeApplier => new FeeApplier( $c->get( 'extra.service' ), $c->get( 'context.factory' ) ) ); } /** * {@inheritDoc} * * @param Container $c Container. */ public function boot( Container $c ): void { add_action( 'woocommerce_cart_calculate_fees', static function ( $cart ) use ( $c ): void { if ( $cart instanceof \WC_Cart ) { $c->get( 'cart.fee_applier' )->apply( $cart ); } }, 20 ); } }