wp-graphql-woocommerce icon indicating copy to clipboard operation
wp-graphql-woocommerce copied to clipboard

CreateOrder returning empty line items

Open pandabrand opened this issue 4 years ago • 3 comments

Describe the bug When I use the CreateOrder Mutation the it is creating an empty line item for each one I send over.

To Reproduce Steps to reproduce the behavior:

  1. Send CreateOrder Mutation with two line items
  2. Response sends back order with four line items

Expected behavior An Order with the same amount of line items as sent over

Using version 0.7.0

Mutation

{"input":
	{
		"clientMutationId":"47f37973-f317-4a7b-b978-1656fa2e8814",
		"isPaid":false,
		"customerId":XXXX,
		"shippingLines":
			[
				{
					"methodId":"flat_rate",
					"methodTitle":"Flat Rate",
					"total":"250"
				}
			],
		"lineItems":
			[
				{
					"id":"cHJvZHVjdDo1Mjk2",
					"productId":5296,
					"quantity":1,
					"total":"$3,490.00"
				},
				{
					"id":"cHJvZHVjdDo1OTIw",
					"productId":5920,
					"quantity":1,
					"total":"$588.00"
				}
			],
		"billing":{...},
		"shipping":{...}
	}
}

Response

"data": {
    "__typename": "RootMutation",
    "createOrder": {
      "order": {
        "databaseId": 1000108089,
        "orderNumber": "1000108089",
        "lineItems": {
          "nodes": [
            {
              "databaseId": 404757,
              "quantity": null,
              "productId": null,
              "total": null,
              "totalTax": null
            },
            {
              "databaseId": 404758,
              "quantity": 1,
              "productId": 5296,
              "total": "3490.00",
              "totalTax": null
            },
            {
              "databaseId": 404759,
              "quantity": null,
              "productId": null,
              "total": null,
              "totalTax": null
            },
            {
              "databaseId": 404760,
              "quantity": 1,
              "productId": 5920,
              "total": "588.00",
              "totalTax": null
            }
          ]
        }
      }
    }
  }

pandabrand avatar Dec 22 '20 19:12 pandabrand

@pandabrand Sorry for late response. Can you elaborate more about the product being used in the order? Are they all simple products? And do you have the DEBUG option check in you WPGraphQL Settings.

kidunot89 avatar Jan 27 '21 19:01 kidunot89

@kidunot89 No worries, they are both Simple products, one is virtual. I didn't have the DEBUG option checked initially but I do know.

pandabrand avatar Jan 28 '21 20:01 pandabrand

@pandabrand Has there been any movement on this issue?

kidunot89 avatar Oct 21 '21 21:10 kidunot89