Try our conversational search powered by Generative AI!

Create Return Programmatically


Commerce 11.

I have used this as a reference point:

And while I can create and process a return in code I am missing a few bits of information that I can't seem to set in code.

Specifically the Totals information and the Total Before Return value on the line items (see image) I can't see any documentation which indicate how these are done.

Any documentation or help would be great.


Jun 28, 2018 12:49

Could not view your picture - and which exactly version you are using?

Jun 28, 2018 13:00

Commerce is on 11.8.2

Does this image work?

Jun 28, 2018 13:09

Hi JSpencer,

In "Total Information" group, it's includes 3 items:

  • Line Items: Is the total of return items(return quantity * placed price).
  • Invalidates Discounts: Is the negate total entry discount amount of order form. For example: If you have a promotion buy 2 get discount of 10% of each item, you buy 3 items with price is 50$ then discount of this is 10% of 3*50$ = 15$. So if you return 2 items then the promotion became invalid => Invalidates Discounts here will be -15$.
  • Return Total: Is total amount of items has returned(return quantity * placed price - total entry discount if it has).

And the "Total Before Return": Is the same with "Return Total" and included order level discount if has(return quantity * placed price - total entry discount if it has - order level discount if it has).

Edited, Jan 05, 2019 6:16
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.