Skip to content

[Bug]: Recent orders widget shows zero order amounts #75

Description

@roncodes

Summary

The Storefront recent orders widget always shows 0 in the order amount column because the widget renders order.meta.total, but the internal orders list response appears to come from the FleetOps index order resource, which does not include Storefront checkout totals in meta.

Current Behavior

The recent orders widget loads orders with:

GET storefront/int/v1/orders

from addon/components/widget/orders.js, then renders the table amount with:

{{format-currency order.meta.total order.meta.currency}}

from addon/components/widget/orders.hbs.

The displayed amount is always 0/empty. Research points to the backend response shape as the likely source:

  • Storefront registers internal orders through fleetbaseRoutes('orders') in server/src/routes.php.
  • Fleetbase\Storefront\Http\Controllers\OrderController extends the FleetOps internal order controller.
  • FleetOps internal order controller defines an $indexResource for list responses.
  • The generic query path uses $indexResource for collection responses.
  • FleetOps' index order resource returns meta as only ['_index_resource' => true], so Storefront-specific meta.total, meta.subtotal, and meta.currency are not present in the recent-orders list payload.

This means the widget is asking for the correct Storefront checkout total field, but the list API response no longer carries the required Storefront order total data.

Expected Behavior

The recent orders widget should show the correct Storefront order total and currency for every order.

The amount column should continue to render through the {{format-currency}} helper using a numeric total and currency code from the order response, for example:

{{format-currency order.meta.total order.meta.currency}}

or an equivalent Storefront-specific response field if the backend intentionally exposes totals outside meta.

Steps to Reproduce

  1. Create or find a Storefront order with a non-zero checkout total.
  2. Open the Storefront home dashboard / recent orders widget.
  3. Observe the order amount column in the recent orders table.
  4. Compare the displayed amount to the checkout/order total stored for the Storefront order.

Affected Area

  • Recent orders widget: addon/components/widget/orders.js
  • Recent orders widget template: addon/components/widget/orders.hbs
  • Internal Storefront orders API: storefront/int/v1/orders
  • Storefront internal order controller: server/src/Http/Controllers/OrderController.php
  • Storefront order filter: server/src/Http/Filter/OrderFilter.php
  • FleetOps internal order list/index resource currently used by inherited query behavior

Proposed Fix

Fix the response shape feeding the Storefront recent orders widget so Storefront order totals are included reliably.

Recommended direction:

  • Add a Storefront-owned internal orders list response or resource for storefront/int/v1/orders instead of relying directly on the FleetOps order index resource.
  • Ensure the list response includes Storefront checkout totals and currency, either under meta.total / meta.currency for compatibility with existing Storefront UI or as a clearly named Storefront amount field paired with a frontend update.
  • Preserve the existing Storefront filtering behavior: current company, meta->storefront_id, payload relationships, tracking number/status requirements, active-store filter, sort, limit, and status filter.
  • Keep the recent orders widget amount rendered through {{format-currency}}.
  • Review related Storefront order views that also read order.meta.total, including customer/order panels, so the fix does not only patch the home widget while leaving the same broken response shape elsewhere.

Avoid fixing this only by switching the widget to transaction_amount: FleetOps transaction amounts can be zero for orders created without a paid transaction, while Storefront checkout totals are stored in Storefront order metadata during checkout capture.

Acceptance Criteria

  • Recent orders widget amount column shows the correct non-zero Storefront order total.
  • Recent orders widget uses {{format-currency}} with the correct currency code.
  • The widget total row sums the same displayed Storefront totals correctly.
  • Storefront internal orders list responses include the fields required by Storefront UI for totals.
  • The fix does not regress FleetOps order list behavior.
  • Coverage or manual verification includes at least one paid delivery order and one pickup order when possible.
  • Frontend lint/tests and relevant backend tests are run, or skipped validation is explained.

Documentation Impact

No public documentation update appears required unless the API response contract for Storefront internal orders is intentionally documented.

API Reference Impact

This affects an internal console API response shape, not the public Storefront API. No fleetbase/postman update appears required unless the internal Storefront orders endpoint is covered there.

Metadata

Metadata

Assignees

Labels

agent:approvedHuman approved AI agent implementationagent:readyIssue is ready for AI agent triage or implementationtype:bugBug fix

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions