Trying to get suggestedRefund

Hi All,

I have the task of migrating the return process of an app to graphql and I am having a bit of a problem with it.

I would like to automatically restock the returned items when creating a return, and only have the merchant approve the refund is this possible? By working through the multistep process Build for return management I can create a return and even automatically approve the refund, but I can’t seem to find a way to actually restock the products automatically.

Asking the AI Assistant gave me an invalid answer … there is no restockType property on returnLineItems.

mutation RestockReturnedItem {
  returnCreate(
    returnInput: {
      orderId: "gid://shopify/Order/625362839",
      returnLineItems: [
        {
          fulfillmentLineItemId: "gid://shopify/FulfillmentLineItem/820022594",
          quantity: 1,
          returnReason: WRONG_ITEM,
          returnReasonNote: "Restocking the returned item.",
          restockType: RETURN
        }
      ]
    }
  ) {
    return {
      id
      status
      returnLineItems(first: 1) {
        edges {
          node {
            id
            returnReason
            returnReasonNote
            restockType
          }
        }
      }
      order {
        id
      }
    }
    userErrors {
      field
      message
    }
  }
}

anyone manage to achieve this? or know how?

I would be grateful for a bit of help.

Cheers,
Gary

Hey Gary,

Would restocking the products in a seperate mutation, following returnCreate be an feasible option? I believe you can use the inventorySetQuantities mutation to restock/ update the inventory based on the info from the return.

Hi Liam,

The idea is not to offer the Merchant the option to restock since we will be taking care of the restocking.

So as I wrote above we would like to be able to set the restock type when creating the return (as is possible using the createRefund mutation) so that if we set restock type when creating the return the merchant does not get the option to restock the product, it will automatically be done according the “quality” of the product and they only have the refund button to refund the order.

This ability is quite important for the fulfillment service provider because they are the ones receiving the returned items and inspect them prior to starting the refund process and decide if the product can be restocked, or based on the agreement with the merchant if the items should be restocked at all (hygiene articles). The merchant then decides if the customer should receive a refund and how much.

I know its possible to set the restock type when creating a refund using the REST API, but it was also not possible to leave the decision for the refund in the merchants hands. Now that we can, it would be cool if the capabilities were also expanded to provide this ability.

Cheers,
Gary

@Liam-Shopify

Solutions is here: Restock items using Flow/GraphQL

or using
reverseFulfillmentOrderDispose - GraphQL Admin to restock or not restock the items.

Cheers,

Gary

1 Like