Unable to update product unitPrice using productPatch mutation
carletonbp
Member Posts: 4
Hello
I'm trying to update the unit price of a product using the productPatch mutation, however when I make the GraphQL request the dashboard doesn't update.
Oddly enough, if I try to update the name or description of a product, that works but not unitPrice.
My input variables look like this:
{ input: { id: <id>, unitPrice: '3600', incomeAccountId: <account id> } }
and my response is successful.
{ productPatch: { didSucceed: true, inputErrors: null, product: { id: <id> } } }
What could I be doing wrong?
0
Comments
Hi @carletonbp ,
That certainly seems strange.
unitPrice
isn't treated any different from the other properties which you've said are working for you.Depending how you're currently performing the tests, using the GraphQL Playground tool may be more streamlined.
I would recommend adding the
unitPrice
to theproduct
response, as well, to check the value of that property immediately after the mutation completes.Thanks for the response @KieronB
I took your suggestion of using the GraphQL playground, it's definitely been faster than I was testing this before.
Unfortunately, the issue still persists. See below a picture of the request that I made. The product id's are blurred. You can see how prior to the response, the price of the product on the invoice is 1200 CAD.
I then make this request, notice the name and unitPrice change
Back to the invoice, the name has changed but the price is still 1200
Is there any step that I am missing?
Thanks for the additional context, @carletonbp
If you check the price of the product on the product list page ("Sales -> Products & Services"), you should see the updated price.
Invoices maintain their own price for Products. When you add a Product to an Invoice, the price will initially be set to the price of the product. You can set a different price than the default without affecting the price of the underlying Product. Whether or not you choose to change the price, the Invoice will record its own value for the price of that Product.
This provides some flexibility: you could charge a different price for different customers, and you can change pricing without impacting existing Invoices. Unfortunately, there isn't a way to programmatically change the price of an Invoice line item after the Invoice has been created.
I see, thank for you clearing up the confusion.
Do you have any suggestions for how I might be able to change the amount required to pay on an invoice while retaining the amount already paid on that invoice?
As far as I know, editing an Invoice within the Wave application does not impact previous payments against that Invoice.