Skip to main content

How to customize return eligibility rules: skipping RMAs

Solidus' built-in process for returns is mighty and flexible, and even allows you to disable RMAs as a prerequisite to creating a customer return.

Go ahead and create an order from the storefront. You must go through the entire checkout process, from adding items to the cart to confirming the payment.

Next, you need to capture the payments in the system and perform the shipments. You can do it either from the admin panel or through the console. E.g.:

order = Spree::Order.find_by_number('R723438584')!)!)

Let us go to the heart of the matter. When you add return items to a customer's return, Solidus checks whether they are eligible for being returned. By default, it uses Spree::ReturnItem::EligibilityValidator::Default. Even if you can replace it altogether, the default validator is flexible enough to allow us to skip only the requirement for an RMA.

Take a look at the stack of steps that EligibilityValidator::Default calls:

# ...
self.permitted_eligibility_validators = [
# ...

Let's use the Solidus initializer to remove the unwanted one:

# ...
Rails.application.config.to_prepare do
# ...

And that's it! You can now simplify the return flow by creating customer returns without going through a previous authorization. You can go ahead and check it out in the admin panel.