Project-7525: [DO NOT MERGE] Feature branch for the new returns flow#2667
Project-7525: [DO NOT MERGE] Feature branch for the new returns flow#2667bc-vivekaggarwal wants to merge 21 commits into
Conversation
…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
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
There was a problem hiding this comment.
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-AUlocale. 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-AUand always usesitem.totalIncTaxeven thoughorder.isTaxInclusiveis available. This will display incorrect amounts/formatting for non-AU stores and for tax-exclusive display settings. Use a locale from context and choosetotalIncTaxvstotalExTaxbased onorder.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.
| account_order: getAccount, | ||
| account_addressbook: getAccount, | ||
| shippingaddressform: getAccount, | ||
| account_new_return: getAccount, | ||
| account_new_return: getAddReturnNew, | ||
| 'add-wishlist': () => import('./theme/wishlist'), |
| {{> components/common/breadcrumbs breadcrumbs=breadcrumbs}} | ||
|
|
||
| <h1> Guest Return Portal</h1> | ||
|
|
| </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 →</a> | ||
| </div> | ||
| </div> | ||
| {{#if date}}<p class="newReturn-orderDate">{{date}}</p>{{/if}} |
| 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'); |
| - 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) |
|
cursor review |
feat(orders): ORDERS-7731 add template for create return page
feat(returns): ORDERS-7717 - add new returns list ui
feat(orders): ORDERS-7718 add return details 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
feat(orders): ORDERS-7707 improve create return page design for mobile/tablet views
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ 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 621d2ce. Configure here.
| </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'}} →</a> |
There was a problem hiding this comment.
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.
Reviewed by Cursor Bugbot for commit 621d2ce. Configure here.
| quantity: parseInt(document.getElementById(`qty-${itemId}`)?.value, 10), | ||
| resolution: document.getElementById(`resolution-${itemId}`)?.value, | ||
| reasonEntityId: document.getElementById(`reason-${itemId}`)?.value, | ||
| }]; |
There was a problem hiding this comment.
Reason ID not parsed as integer
Low Severity
buildReturnInput parses lineItemEntityId and quantity with parseInt, but passes reasonEntityId as the raw select string. A GraphQL createReturn input that expects numeric IDs may reject or mishandle the payload once ORDERS-7715 wires the mutation.
Reviewed by Cursor Bugbot for commit 621d2ce. Configure here.


What?
This PR is for a feature branch to park all reviewed changes related to the new returns flow PROJECT-7525
Requirements
Tickets / Documentation
PROJECT-7525
Screenshots (if appropriate)
Not applicable: They are part of individual PRs
Testing
TBD
Note
Medium Risk
Large, customer-facing order/returns surface with new templates and JS, though v2 is feature-flagged and create-return submit plus return-details routing/data are still incomplete.
Overview
Introduces the Returns v2 storefront experience behind
settings.returns_v2_enabled, while keeping the legacy flow when that flag is off.New create-return flow:
create_returnpage type loadscreate-return.js, which validates line-item qty/resolution/reason and enables submit only when selections are complete;buildReturnInput()prepares the Storefront GQL payload, but submit still prevents default with a TODO for the mutation (ORDERS-7715). Matchingcreate-return.htmland.newReturnstyles ship with the change.Account returns UX: When v2 is enabled,
returns.htmlrendersreturns-list-v2(RMA, OPEN/IN_PROGRESS/CLOSED badges, dates, item count) instead of the legacy list. Order details and the orders list Return links now use{{#or returns_v2_enabled returns_enabled}}instead of onlyreturns_enabled.Scaffolding:
return-details.htmlplusreturn-details.js(mock data, client-rendered intodata-*hooks) and a placeholderguest-return-portal.htmlare added; return-details is not wired inapp.jsyet per template comments. Expandedlang/en.jsoncopy supports the new UI; legacyadd-return.htmlgets minor a11y fixes.Reviewed by Cursor Bugbot for commit 621d2ce. Bugbot is set up for automated code reviews on this repo. Configure here.