setCustomAttribute from API not working?

While working on a Webflow Designer App, I ran into this issue:

const selectedElement = await webflow.getSelectedElement() as CommerceCheckoutShippingAddressWrapperElement;
await selectedElement.setCustomAttribute("test", "value"); // setCustomAttribute is not doing anything :(

I would expect this to set a custom attribute on the element with name “test” and value “value”, but it doesn’t do anything from what I can tell.

Am I missing something? Or is this a bug?

Note: I also tried to use setDomId, and that also appears to do nothing.

Hi @Justin_Hendrickson - hmm, I’d also expect you to still be able to set a custom attribute (did some testing on my own test site to confirm).

Are you doing a element.type check to see if it is element.type === "CommerceCheckoutShippingStreetAddress" beforehand just to double check the selected element is that type of element?

One last thing is can you confirm in either console logging or checking in browser console that window.webflowDesignerApiVersion is '2'?

1 Like

Ah that was it. I wasn’t on version 2. Thank you! And thank you for the quick response :smile:

1 Like