API Adding to Order Note Attributes

Highlighted
New Member
15 0 0

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

 

0 Likes
Shopify Staff
Shopify Staff
1489 67 220

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.

0 Likes
New Member
15 0 0

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

0 Likes