Skip to content

Returns (RMA)

Modules: Magenx_Rma (returns engine, admin, REST, email) and Magenx_RmaGraphQl (storefront API) · forked from the MIT-licensed mage-os/module-rma 2.4.1

Return Merchandise Authorization. Customers request returns from their account; guests do it with their order number and email. Staff approve and handle them in the admin, with a comment thread and file attachments on each return. With the Help Desk installed, the storefront’s EU withdrawal form works too.

Returns tab in the customer account, with no return requests yet
Returns in the customer account.
StorefrontWhat happens there
Account > ReturnsList and details of the customer’s returns, with comments.
Account > Orders“Create return” on an eligible order.
Guest order lookup (/guest/order)Guests find their order by number and email, then create or view a return.
Withdrawal form (/withdrawal)The EU right-of-withdrawal declaration. Needs the Help Desk.

An order can be returned only when all of these hold:

  1. Returns are enabled for the order’s website.
  2. The order status is in Allowed Order Statuses (default: Complete).
  3. The order is within the Return Period (default 30 days; 0 means no limit).
  4. At least one item still has quantity left to return. Virtual and downloadable items are excluded.
requeststaff askscustomer repliescustomer shipsstaff receivescustomer cancels

New

NeedDetails

Approved

Rejected

Shipped

Received

Resolved

Canceled

Every status change emails the customer. Auto-Approve Returns skips the manual approval step.

Everything is under Sales > RMA:

  • RMA Requests: the grid of all returns. Add New RMA creates one for an order: choose the order, reason and resolution, then the items, quantities and condition.
  • On a return you can change its status, reason, resolution and admin notes, and talk to the customer in the Comments thread. Tick off Visible to Customer for an internal note. Files can be attached by drag and drop.
  • Statuses, Reasons, Resolution Types and Item Conditions are editable lists. Reasons, resolutions and conditions feed the storefront’s return form.

This module replaces mage-os/module-rma. Never run both: they use the same tables and admin routes.

  1. Remove mage-os/module-rma (and any patch for it) from the Magento composer.json, then run composer update mage-os/module-rma.
  2. Install Magenx_Rma and Magenx_RmaGraphQl and run setup:upgrade.
  3. Delete the old module’s row: DELETE FROM setup_module WHERE module = 'MageOS_RMA';
  4. Re-save custom admin roles. Permission IDs moved from MageOS_RMA::* to Magenx_Rma::*; the default Administrator role is unaffected.

Existing returns, settings and email templates carry over.

Terminal window
composer require magenxcommerce/module-rma magenxcommerce/module-rma-graph-ql
bin/magento module:enable Magenx_Rma Magenx_RmaGraphQl
bin/magento setup:upgrade
bin/magento setup:di:compile # production mode only
bin/magento cache:flush

Deploy Magenx_RmaGraphQl before a storefront build that uses its return queries.

Stores > Configuration > Sales > RMA - Return Management

General

SettingDefaultScopeNotes
Enable RMA
rma/general/enabled
NoWebsiteYes/No. Enable or disable the RMA functionality.
Increment ID Prefix
rma/general/increment_id_prefix
RMA-WebsiteText. Prefix for the RMA increment ID (e.g. RMA-).
Return Period (Days)
rma/general/return_period
30WebsiteText. Number of days after order completion within which a return can be requested.

Policy

SettingDefaultScopeNotes
Auto-Approve Returns
rma/policy/auto_approve
NoWebsiteYes/No. If enabled, new RMA requests will be automatically approved.
Allowed Order Statuses
rma/policy/allowed_order_statuses
completeWebsiteMultiple select. Only orders with these statuses can have a return request.

Right of Withdrawal (EU)

RMAs opened from a consumer withdrawal declaration. These ignore the Return Period and Allowed Order Statuses above.

SettingDefaultScopeNotes
Create RMAs from Withdrawals
rma/withdrawal/enabled
NoWebsiteYes/No. When a withdrawal is declared, create an RMA for shipped items and cancel orders that have not shipped yet. Needs Enable RMA as well. When off, declarations are only recorded in the helpdesk.
Withdrawal Period (Days)
rma/withdrawal/period_days
14WebsiteText. Shown when Create RMAs from Withdrawals = Yes. Counted from the last shipment of the order. A later declaration is still accepted, but its RMA is flagged for staff review.
Delivery Transit (Days)
rma/withdrawal/transit_days
0WebsiteText. Shown when Create RMAs from Withdrawals = Yes. Added to the shipment date to approximate when the customer received the goods, since Magento records dispatch, not delivery.
Auto-Approve Withdrawal RMAs
rma/withdrawal/auto_approve
YesWebsiteYes/No. Shown when Create RMAs from Withdrawals = Yes. Withdrawal RMAs start as Approved (Yes) or New Request (No). A withdrawal is a legal right, so approval only confirms the return logistics. Late declarations always start as New Request.

Email Notifications

SettingDefaultScopeNotes
Email Sender
rma/email/sender_identity
General ContactStore viewDropdown.
New RMA Email Template (Customer)
rma/email/customer_new_template
Module's default templateStore viewDropdown. Email sent to the customer when a new RMA is created.
Status Change Email Template (Customer)
rma/email/customer_status_change_template
Module's default templateStore viewDropdown. Email sent to the customer when the RMA status changes.
New RMA Email Template (Admin)
rma/email/admin_new_template
Module's default templateStore viewDropdown. Email sent to the admin when a new RMA is created.
Admin Notification Email
rma/email/admin_notify_email
emptyStore viewText. Email address to receive admin RMA notifications.

Attachments

SettingDefaultScopeNotes
Allowed File Extensions
rma/attachments/allowed_extensions
jpg,jpeg,png,gif,webp,mp4,mov,pdf,doc,docxWebsiteMultiple select.
Maximum File Size (MB)
rma/attachments/max_file_size
10WebsiteText. Maximum allowed file size in megabytes per single file.
Maximum Files Per Upload
rma/attachments/max_files
5WebsiteText. Maximum number of files allowed per RMA creation or comment.
  • Sales > RMA > Manage RMA Requests
  • Sales > RMA > RMA Statuses
  • Sales > RMA > RMA Reasons
  • Sales > RMA > RMA Resolution Types
  • Sales > RMA > RMA Item Conditions

Grant these under System > Permissions > User Roles > Role Resources:

ResourceUnderID
RMASalesMagenx_Rma::rma
Manage RMA RequestsSales > RMAMagenx_Rma::rma_manage
Manage RMA StatusesSales > RMAMagenx_Rma::rma_status
Manage RMA ReasonsSales > RMAMagenx_Rma::rma_reason
Manage RMA Resolution TypesSales > RMAMagenx_Rma::rma_resolution_type
Manage RMA Item ConditionsSales > RMAMagenx_Rma::rma_item_condition
RMA ConfigurationStores > Settings > ConfigurationMagenx_Rma::config
  • REST API: /V1/rma, with items, comments and the lookup lists as sub-resources. All endpoints need an admin integration token.
  • Events for your own modules: rma_created_after, rma_status_change_after, and one per status: rma_approved_after, rma_rejected_after, rma_shipped_by_customer_after, rma_received_after, rma_canceled_after, rma_resolved_after.

Customer operations need a customer token and check the order belongs to them. Guest operations are authenticated by order number and email. returnAttributesMetadata is public: guests create returns too. Protect submitWithdrawal with Turnstile at the storefront proxy.

Queries

customerReturns(pageSize: Int = 20, currentPage: Int = 1, sort: CustomerReturnsSortInput): CustomerReturnsOutput

List return requests for the logged-in customer. Never cached: the answer is private to the signed-in customer.

ArgumentTypeDescription
pageSizeInt = 20
currentPageInt = 1
sortCustomerReturnsSortInput
customerReturn(rma_id: Int!): CustomerReturn

Get a single return request by ID for the logged-in customer. Never cached: the answer is private to the signed-in customer.

ArgumentTypeDescription
rma_idInt!
guestReturn(order_number: String!, email: String!, rma_id: Int!): CustomerReturn

Get a single return request by ID for a guest order. Never cached: the answer is private to the signed-in customer.

ArgumentTypeDescription
order_numberString!
emailString!
rma_idInt!
returnComments(rma_id: Int!, pageSize: Int = 50, currentPage: Int = 1): ReturnCommentsOutput

List comments for a return request (customer-visible only). Never cached: the answer is private to the signed-in customer.

ArgumentTypeDescription
rma_idInt!
pageSizeInt = 50
currentPageInt = 1
returnAttributesMetadata: ReturnAttributesMetadata

Lists the active reasons, resolution types and item conditions a customer or guest can choose from when creating a return.

Mutations

createCustomerReturn(input: CreateReturnInput!): CreateReturnOutput

Create a return request for a customer order.

ArgumentTypeDescription
inputCreateReturnInput!
createGuestReturn(input: CreateGuestReturnInput!): CreateReturnOutput

Create a return request for a guest order.

ArgumentTypeDescription
inputCreateGuestReturnInput!
addReturnComment(input: AddReturnCommentInput!): ReturnComment

Add a comment to a return request.

ArgumentTypeDescription
inputAddReturnCommentInput!
submitWithdrawal(input: SubmitWithdrawalInput!): SubmitWithdrawalOutput

Declare withdrawal from a purchase (EU right of withdrawal). Records the declaration as submitted and emails a confirmation; staff then identify the order and handle the return. Open to guests.

ArgumentTypeDescription
inputSubmitWithdrawalInput!

Types

type CustomerReturn
FieldTypeDescription
rma_idIntThe RMA entity ID.
increment_idStringThe RMA increment ID (e.g. RMA-000001).
order_numberStringThe associated order increment ID.
statusReturnLookupValueThe current RMA status.
reasonReturnLookupValueThe return reason.
resolution_typeReturnLookupValueThe preferred resolution type.
items[ReturnItem]The items included in this return.
comments[ReturnComment]Customer-visible comments.
created_atStringCreation date.
updated_atStringLast update date.
is_withdrawalBooleanTrue when the return was opened from a withdrawal declaration.
withdrawal_declared_atStringWhen the withdrawal declaration was received (UTC), for withdrawal returns.
helpdesk_ticket_codeStringThe support ticket that records the withdrawal declaration.
return_carrierStringCarrier of the return shipment, once known.
return_tracking_numberStringTracking number of the return shipment, once known.
type ReturnItem
FieldTypeDescription
item_idIntThe RMA item entity ID.
order_item_idIntThe original order item ID.
product_nameStringThe product name.
product_skuStringThe product SKU.
qty_requestedIntQuantity requested for return.
qty_approvedIntQuantity approved.
qty_returnedIntQuantity returned.
conditionReturnLookupValueItem condition.
type ReturnComment
FieldTypeDescription
comment_idIntThe comment entity ID.
author_typeStringAuthor type: customer or admin.
author_nameStringAuthor display name.
commentStringComment text.
created_atStringComment creation date.
type ReturnLookupValue
FieldTypeDescription
idIntEntity ID.
codeStringUnique code.
labelStringStore-localized label.
type ReturnAttributesMetadata - The selectable lookup values used when creating a return.
FieldTypeDescription
reasons[ReturnLookupValue]Active return reasons, ordered by sort order.
resolution_types[ReturnLookupValue]Active resolution types, ordered by sort order.
conditions[ReturnLookupValue]Active item conditions, ordered by sort order.
input CustomerReturnsSortInput - Specifies which field to sort return requests on, and in which direction.
FieldTypeDescription
sort_fieldCustomerReturnsSortableField!
sort_directionSortEnum!
enum CustomerReturnsSortableField - The fields a customer's return requests can be sorted on.
ValueDescription
CREATED_ATSorts return requests by the date they were created.
RMA_IDSorts return requests by their RMA id.
type CustomerReturnsOutput
FieldTypeDescription
items[CustomerReturn]List of return requests.
total_countIntTotal number of return requests.
page_infoSearchResultPageInfoPagination info.
type ReturnCommentsOutput
FieldTypeDescription
items[ReturnComment]List of comments.
total_countIntTotal number of comments.
page_infoSearchResultPageInfoPagination info.
type CreateReturnOutput
FieldTypeDescription
returnCustomerReturnThe created return request.
input CreateReturnInput
FieldTypeDescription
order_idInt!The order entity ID.
reason_idInt!The return reason ID.
resolution_type_idInt!The preferred resolution type ID.
items[CreateReturnItemInput!]!Items to return.
input CreateGuestReturnInput
FieldTypeDescription
order_numberString!The order increment ID.
emailString!The order billing email.
reason_idInt!The return reason ID.
resolution_type_idInt!The preferred resolution type ID.
items[CreateReturnItemInput!]!Items to return.
input CreateReturnItemInput
FieldTypeDescription
order_item_idInt!The order item ID.
qty_requestedInt!Quantity to return.
condition_idIntItem condition ID.
input AddReturnCommentInput
FieldTypeDescription
rma_idInt!The RMA entity ID.
commentString!Comment text.
input SubmitWithdrawalInput - A withdrawal declaration, as the consumer states it.
FieldTypeDescription
emailString!The declarant's email address. The confirmation is sent here.
nameString!The declarant's name.
order_numberString!The order number as the declarant gives it.
itemsStringThe products withdrawn from (names or SKUs), free text, at most 2000 characters. Empty means the whole order.
messageStringOptional free text, at most 2000 characters.
type SubmitWithdrawalOutput - The recorded declaration.
FieldTypeDescription
ticket_codeStringReference of the recorded declaration, to quote to customer service.
received_atStringWhen the declaration was received (UTC, Y-m-d H:i:s).