Adding notes to order in checkout ui extension

Solved

Adding notes to order in checkout ui extension

dev_dnShop
Shopify Partner
26 1 0

Hi,
I have been working on a task that basically is to when an order is submitted then add some notes to orders based on the logic in the extension.
I have read the docs and found that there is a hook named 

useApplyNoteChange()
can we use this to add notes from checkout using the checkout ui extension? I have tried using it but it didn't add the notes with order. below is the snippet I am using to achieve this.
if (our logic) {
setNotes({
type: "updateNote",
value:`there comes the note`,
});
}

Any help in this regard would be highly appreciated.
Thanks.
Accepted Solution (1)
dev_dnShop
Shopify Partner
26 1 0

This is an accepted solution.

if (our logic) {
setNotes({
type: "updateNote",
note:`there comes the note`,
});
}

This was resolved by setting the value to note in the object passed. A slight overlook on my side.

View solution in original post

Replies 11 (11)

dev_dnShop
Shopify Partner
26 1 0

anybody ??

 

dev_dnShop
Shopify Partner
26 1 0

This is an accepted solution.

if (our logic) {
setNotes({
type: "updateNote",
note:`there comes the note`,
});
}

This was resolved by setting the value to note in the object passed. A slight overlook on my side.

analyst
Shopify Partner
3 0 0

Please explain how to pass datepicker value to note in the object passed?

dev_dnShop
Shopify Partner
26 1 0

You can sync the date picker's current value to this object via some state or variable so that whenever the date picker value changes the note object always gets the updated value of the date picker.

analyst
Shopify Partner
3 0 0

Can we pass the datepicker value as additional note ?

 

https://prnt.sc/Pt7raZYJnV7F

dev_dnShop
Shopify Partner
26 1 0

@analyst not sure about additional notes. I passed the dynamic data as note-only using 

useApplyNoteChange() hook provided.
analyst
Shopify Partner
3 0 0

Do you know how to pass date value as note_attribute ?

imabhijithak
Shopify Partner
7 0 0

hey do you might please share the whole code , as I'm

also kind of doing same task and stuck , it would ne really helpful thanks

sowndharya
Shopify Partner
9 0 2

stuck with same useApplyNoteChange(). 

useApplyNoteChange() hook will work under "purchase.checkout.delivery-address.render-after" target. I am placing this below code directly under the React function. But it is not working. Anyone Please help on this.
 

 

useApplyNoteChange({
    type: "updateNote",
    note: "shipping note",
    });

 

owarway
Shopify Partner
1 0 0

Hi,

for useApplyNoteChange to work you want to use the returned function and not pass arguments to the hook directly:

const applyNoteChange = useApplyNoteChange();
applyNoteChange({type: 'updateNote', note: 'some amazing note info'})

 

sowndharya
Shopify Partner
9 0 2

Hi Got it. Thanks