#chief-pricingtable-clientreferenceid

1 messages · Page 1 of 1 (latest)

frigid fiberBOT
regal pike
#

chief-pricingtable-clientreferenceid

#

let me have a look

broken matrix
#

ok thank you. essentially the 4th to last line in the code block

regal pike
#

I just tried and it works totally fine for me

#

You need to make sure that when you render that HTML it has the real value inside

broken matrix
#

do you remove the quotes? that would be what i would expect

regal pike
#

No, I just did client-reference-id="testing"

#

and I see that on the resulting Checkout Session

broken matrix
#

what if i want it to be dynamically set with the current users id on my page. each user has a user id. i would just have to set the value in there rather than the variable?

regal pike
#

yes

#

you need to make sure that the value is set there before you render the html basically

broken matrix
#

if i can use the variable then it should dynamically set it in there. maybe i have to refactor my code because i am using a tool called bildr. ill have to play with it then…. and it should return the client-id thing back in the url route when i set that client-id thing in the end of the url route… can i also retrieve this value as well? i dont really have hooks available without using third party hooks

#

everything else i am doing would be straight api call (checking if the subscription is still current, etc)

#

i guess that isnt really needed if i have the client id already, and im appending that to their user account on my backend

regal pike
#

As the developer, you need to render the HTML you shared above with the real value of client-reference-id="{{CLIENT_REFERENCE_ID}}"

#

you can't use a variable client-side

broken matrix
#

ok that makes sense. i just have to figure out how to get it in there. i will have to see if i can maybe set an id=“myid” in there or something to be able to push the value into the element in the dom

#

and then use a querySelector to access it possobly

#

its complicated. 😅

regal pike
#

I don't know what "use a querySelector" could mean but if you have more specific details I'm happy to help

broken matrix
#

the code is inside a codeblock on my building tool. the only way to pass a value to it that i know of would be to inject it with value = document.QuerySelector(“myId”).innerHTML or something like that

#

ill mess with it and see what i can come up with. thank you

regal pike
#

I don't think that's possible

#

@broken matrix okay I asked a colleague who confirmed you can dynamically update this in JS

#

like set a custom id to your PricingTable element and then const pt = document.getElementById("pricingtable"); pt.setAttribute("client-reference-id", "abc");

broken matrix
#

yep. probably have to do it with js

#

should work

#

chatGPT to the rescue.. hahah