Skip to content

Project-7525: [DO NOT MERGE] Feature branch for the new returns flow#2667

Open
bc-vivekaggarwal wants to merge 32 commits into
masterfrom
feature/PROJECT-7525-new-returns-flow
Open

Project-7525: [DO NOT MERGE] Feature branch for the new returns flow#2667
bc-vivekaggarwal wants to merge 32 commits into
masterfrom
feature/PROJECT-7525-new-returns-flow

Conversation

@bc-vivekaggarwal

@bc-vivekaggarwal bc-vivekaggarwal commented May 27, 2026

Copy link
Copy Markdown

What?

This PR is for a feature branch to park all reviewed changes related to the new returns flow PROJECT-7525

Requirements

  • CHANGELOG.md entry added (required for code changes only)

Tickets / Documentation

PROJECT-7525

Screenshots (if appropriate)

Not applicable: They are part of individual PRs

Testing

TBD


Note

Medium Risk
Touches order return submission via Storefront GraphQL and broad account/order template gating, but changes are theme-scoped behind returns settings rather than core checkout or auth.

Overview
This PR lands the returns v2 storefront experience: shoppers can request returns on a new create-return page, see an updated returns list when v2 is on, and open a return details view. Entry points on the orders list and order details page are gated on settings.returns_v2_enabled with settings.returns_enabled as fallback.

The create-return page adds line-item quantity, preferred resolution, and reason controls, validates before submit, and posts the createReturn Storefront GraphQL mutation (with injected order context and API token) instead of the legacy form POST. Success swaps the form for an inline confirmation; errors surface in-page.

Account returns switches to returns-list-v2 (status badges, dates, item count, view-details link) when v2 is enabled; otherwise the legacy list remains. A new return details template renders RMA, status, line items, and a summary sidebar from return_detail context. A guest return portal page is added as a stub.

Supporting changes include new SCSS for create/detail layouts, status label styling, expanded lang/en.json copy, legacy add-return table a11y tweaks, and app.js page loaders for create_return and return detail page types.

Reviewed by Cursor Bugbot for commit 38101ea. Bugbot is set up for automated code reviews on this repo. Configure here.

@bc-vivekaggarwal bc-vivekaggarwal requested a review from a team as a code owner May 27, 2026 00:42
@denis-bc denis-bc requested a review from Copilot May 27, 2026 00:50
@BC-SEven BC-SEven changed the title Project-7525: Feature branch for the new returns flow Project-7525: [DO NOT MERGE] Feature branch for the new returns flow May 27, 2026
@denis-bc denis-bc requested review from Copilot and removed request for Copilot May 27, 2026 03:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR parks initial Cornerstone theme changes for PROJECT-7525’s “new returns flow”, adding new templates/assets for a redesigned return-request experience and gating existing “Return” affordances on a new settings.returns_v2_enabled flag (with fallback to settings.returns_enabled).

Changes:

  • Add new return-related templates: a guest return portal page and a new account “add return” page layout.
  • Add new styling and a new page manager (AddReturnNew) plus bundle wiring for the new return-request UI.
  • Gate “Return” entry points in order details and orders list on returns settings; update CHANGELOG.md.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
templates/pages/guest-return-portal.html New guest-facing return portal page scaffold.
templates/pages/account/orders/details.html Gate “Return” button using returns_v2_enabled OR returns_enabled.
templates/pages/account/add-return-new.html New account return-request page markup for the redesigned flow.
templates/components/account/orders-list.html Gate “Return Items” link using returns_v2_enabled OR returns_enabled.
CHANGELOG.md Add draft entries for the new return pages / gating changes.
assets/scss/components/stencil/addReturn/_addReturn.scss Add styling for the new return-request page (.newReturn).
assets/js/theme/add-return-new.js New page manager that renders the new return UI (currently with placeholder data).
assets/js/app.js Wire account_new_return page type to load the new return page manager.
Comments suppressed due to low confidence (3)

assets/js/theme/add-return-new.js:96

  • Date formatting is hardcoded to the en-AU locale. This will display incorrect date formats for stores with different locales; use store locale from Stencil context (e.g. this.context.storeLocale) or omit the locale to allow the browser/store locale to drive formatting.
            // TODO ORDERS-7715: invoke createReturn Storefront GQL mutation.
        });
    }
}

assets/js/theme/add-return-new.js:142

  • Currency formatting is hardcoded to en-AU and always uses item.totalIncTax even though order.isTaxInclusive is available. This will display incorrect amounts/formatting for non-AU stores and for tax-exclusive display settings. Use a locale from context and choose totalIncTax vs totalExTax based on order.isTaxInclusive (or use server-provided formatted totals if available).
    assets/js/theme/add-return-new.js:239
  • console.log('Submitting return', ...) should not ship in theme code. Either remove it or gate it behind an explicit debug flag, and replace with the real API call / proper error handling when wiring this up.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread assets/js/app.js
Comment on lines 12 to 16
account_order: getAccount,
account_addressbook: getAccount,
shippingaddressform: getAccount,
account_new_return: getAccount,
account_new_return: getAddReturnNew,
'add-wishlist': () => import('./theme/wishlist'),
Comment on lines +3 to +6
{{> components/common/breadcrumbs breadcrumbs=breadcrumbs}}

<h1> Guest Return Portal</h1>

Comment on lines +10 to +16
</div>
<div class="newReturn-headerActions">
<a href="{{../urls.account.orders.all}}" class="newReturn-btnBack">{{lang 'account.orders.return.back_button'}}</a>
<a href="/return-policy" class="newReturn-btnPolicy">View return policy &rarr;</a>
</div>
</div>
{{#if date}}<p class="newReturn-orderDate">{{date}}</p>{{/if}}
Comment thread assets/js/theme/add-return-new.js Outdated
Comment on lines +9 to +20
this.bindSubmit($form);
}

bindOrderLineItemEvents() {
document.querySelectorAll('.newReturn-stepperBtn').forEach(button => {
button.addEventListener('click', () => {
// Derive itemId from the parent row — buttons do not carry data-item-id,
// so the [data-item-id] selector stays scoped to the row container only.
const row = button.closest('.newReturn-orderLineItem');
const itemId = row?.dataset?.itemId;
if (!itemId) return;
const action = button.getAttribute('data-action');
Comment thread CHANGELOG.md
- Fix duplicate `id="default_instrument"` on Update Payment Method page [#2661](https://github.com/bigcommerce/cornerstone/pull/2661)
- Respect `available_to_sell` on PDP so the Sold Out alert is hidden and the Add to Cart button stays enabled for backorderable products, and is disabled when quantity exceeds `available_to_sell` [#2659](https://github.com/bigcommerce/cornerstone/pull/2659)
- Updated accessibility features [2656](https://github.com/bigcommerce/cornerstone/pull/2656)
- Adds new guest-return-portal page. [2645](https://github.com/bigcommerce/cornerstone/pull/2645)
@denis-bc

Copy link
Copy Markdown

cursor review

Comment thread assets/js/app.js Outdated
Comment thread assets/js/theme/add-return-new.js Outdated
Comment thread templates/pages/account/add-return.html Outdated
</div>
<div class="newReturn-headerActions">
<a href="{{../urls.account.orders.all}}" class="button">{{lang 'account.returns.back'}}</a>
<a href="/return-policy" class="button button--primary">{{lang 'account.returns.view_return_policy'}} &rarr;</a>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Return policy URL not localized

Medium Severity

The “View return policy” action points to a root-absolute /return-policy path instead of a storefront-aware URL, so it can 404 or miss the language subfolder on multi-language channels.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 621d2ce. Configure here.

Comment thread assets/js/theme/create-return.js
Comment thread assets/js/theme/create-return.js
requestedResolution: this.buildRequestedResolution(document.getElementById(`resolution-${itemId}`)?.value),
}];
}),
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional note omitted from payload

Medium Severity

The create-return page collects an “Additional Note” in data-new-return-note, but buildReturnInput() never reads that field, so shopper notes are dropped and never sent with the createReturn mutation.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit bcea92e. Configure here.


// Storefront GraphQL `createReturn` mutation
createReturn(input) {
return fetch('/graphql', {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GraphQL URL ignores storefront base

Medium Severity

createReturn posts to a hardcoded /graphql path. On multi-language subfolder storefronts, that can miss the localized base URL used elsewhere for theme API calls, so the mutation may hit the wrong host path and fail.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit bcea92e. Configure here.

<select class="form-select form-select--small" id="resolution-{{id}}" aria-label="{{lang 'account.returns.select_resolution'}}">
<option value="">{{lang 'account.returns.select_resolution'}}</option>
{{#each ../../resolutions}}
<option value="{{resolutionType}}">{{label}}</option>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolution option value mismatch

Medium Severity

Resolution <option> values use resolutionType, while buildRequestedResolution() treats any non-system value as customResolutionEntityId. Custom resolutions whose type is CUSTOM can send the literal string CUSTOM instead of the real entity id.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit bcea92e. Configure here.

Comment thread templates/components/account/returns-list-v2.html Outdated
<h6 class="account-orderStatus-label account-orderStatus-label--closed">{{lang 'account.returns.status.closed'}}</h6>
{{/if}}
</div>
<a class="button button--small" href="/account.php?action=view_return&return_id={{id}}">{{lang 'account.returns.list.view_details'}}</a>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Return details link wrong locale

Medium Severity

The “View details” link uses a hardcoded /account.php?action=view_return&return_id=... href instead of a storefront urls helper, so on multi-language sites the link may leave the active locale path and fail or show the wrong context.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 281c2c9. Configure here.

Comment thread templates/pages/account/return-details.html

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 7 total unresolved issues (including 6 from previous reviews).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 34bc18e. Configure here.

} finally {
this.isSubmitting = false;
if (submitBtn) submitBtn.disabled = false;
if (overlay) overlay.style.display = '';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Submit re-enabled without validation

Medium Severity

After a failed or errored createReturn request, the submit handler’s finally block sets return-new-submitBtn to enabled without calling updateSubmitState(), so the button can stay clickable when no line items have quantity, resolution, and reason filled in.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 34bc18e. Configure here.

jpajar and others added 7 commits July 1, 2026 11:07
…2653)

* feat(returns): ORDERS-7704 condition for new returns on orders page

* feat(returns): ORDERS-7704 condition for new returns on orders page - confirmed
feat(orders): ORDERS-7706 add new return page layout
…context (#2665)

* feat(returns): ORDERS-7708 new-return page — render items from order context, stepper qty controls, responsive layout, gate behind returns_v2_enabled flag

* feat(returns): ORDERS-7708 new-return page - review feedback
jpajar and others added 25 commits July 1, 2026 11:07
feat(orders): ORDERS-7706 add new return page layout
* feat(returns): ORDERS-7764 render create return page with stencil context

* feat(returns): ORDERS-7764 render create return page with stencil context

* feat(returns): ORDERS-7764 render create return page with stencil context

* feat(returns): ORDERS-7764 render create return page with stencil context

* feat(returns): ORDERS-7764 fix code review comments

* feat(returns): ORDERS-7764 fix code review comments

* feat(returns): ORDERS-7764 fix design feedback

* feat(returns): ORDERS-7764 fix design feedback
@BC-SEven BC-SEven force-pushed the feature/PROJECT-7525-new-returns-flow branch from 34bc18e to 38101ea Compare July 1, 2026 01:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants