FROM CACHE - en_header

API Adding to Order Note Attributes

cmtgolf05
Tourist
15 0 3

I am trying to add to order note attributes. Whenever I try this, it over writes what is there in the attributes. Rather than over writing I would like to be able to the note attributes

 

$postData = array("order" => array(

"note_attributes" => array (
		array(
         "name" => "Note 1",
          "value"=> "Value 1",
		),		
        ),
));

This posts to note attributes.

 

If I want to at a later date add another note attribute such as:

$postData = array("order" => array(

"note_attributes" => array (
		array(
         "name" => "Note 2",
          "value"=> "Value 2",
		),		
        ),
));

This overwrites the first note and now I am left with only one note. Note 2 and Value 2.

 

Is there any way to add to the note attributes rather than replacing or over writing?

 

Thank you,

Corey

 

Replies 5 (5)
Alex
Shopify Staff
Shopify Staff
1561 81 325

Hey @cmtgolf05.

 

It looks like the overwriting of note attributes is deliberate, so the best strategy for now would be to first get the note attributes and adding those to your payload first, then appending your added note attributes before saving.

 

That said, I think if it's feasible we should append the values you provide. It leaves much less room for unintended outcomes (apps overwriting your attributes, you having to double your call throughput, etc). I'll make sure that feedback (even if it's just my own) is conveyed.

 

Cheers.

Alex | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

cmtgolf05
Tourist
15 0 3

Alex,

 

Thank you for your response. At least its good to know it wasn't me. And yes I agree with your feedback. It makes most sense to me to be able to add to the notes or note attributes rather than having them overwritten.

 

Thank you for your reply. I will go with the method of getting current notes and then appending the new notes to the response and posting all together at once.

 

- Corey

zhuddart
Shopify Partner
8 0 1

Hey Corey,

I'm looking to do the same thing, did you manage to get it to work by using GET and then PUT together?

 

LeoHackin
New Member
1 0 0

Hello @zhuddart ,

You can't. 🙂 Since GET and PUT are verbs to access a REST Api, you need to do this separetelly. 😉 

stouchetteTG
New Member
2 0 0

It would be great to be able to append a note_attribute, and even better if you could also update that same note_attribute. It's silly to have to Get then all, and re Put them all just to add one. Seems like there should be an option to overwrite or append as well as edit if you push a value to an existing name. Ugh so frustrating and limiting for people that actually want to do cool stuff to run their business better.