That sounds good, I was just checking in here to see how it was going.
Regards,
Jakob
Hi Jakob, we were able to detect the issue on our code and now our main CRED developer is evaluating whats steps will need to be taken to correct this.
As soon as I hear from him I'll let you know.
Regards,
Yuri.
OK, that sounds great and it's very timely for my current needs.
Regards,
Jakob
Hi Jakob, our CRED developer noticed that the Json format you used might be throwing off the parsing. Would you mind testing your code with the following shortcode?
add_shortcode( "evidensia-register-productid", "evidensia_register_product_id" );
function evidensia_register_product_id() {
$product_id = $_POST['product_id'];
//$product_id_json = "{'value':'$product_id'}";
$product_id_arr = array('value'=>$product_id);
return json_encode($product_id_arr);
}
That code works better. It gets the right id into the CRED form in the custom field.
The problem now is that I'm back at the problem with "Sorry, this product cannot be purchased." You should be able to see that at the test site I've provided.
I've disabled stock management in WooCommerce setting, because it's not needed. Why then do I now get the "not purchasable" message?
PS: Wouldn't it be good if you add a code example about the json formatting in point 2.1 here?:
https://toolset.com/documentation/user-guides/using-cred-commerce-to-add-payments-to-forms/
For some reason, it seems to work, when I create the generic custom field as a SELECT-field instead of a RADIO-field:
[cred_generic_field field="evi-product-id" type="select" class="" urlparam=""]
{
"required":0,
"validate_format":0,
"persist":1,
"default":[],
"options":[ [evidensia-register-productid] ]
}
[/cred_generic_field]
Good for me, but I hope you will figure out why the RADIO-field doesn't work, since the docs says you can use either.
Hi Jakob, thanks for the catch! I'll inform our CRED developer and he will make the appropriate changes on the Radio element.
Thanks a lot for your patience on this issue and for helping us debug our product. If there is anything else you need don't hesitate to contact us!
Regards,
Yuri.
I hope you'll also update the docs 🙂
One more thing, I'm trying to add a class on the SELECT-field in order to hide it :
[cred_generic_field field="evi-product-id" type="select" class="skjul" urlparam=""]
{
"required":0,
"validate_format":0,
"persist":1,
"default":[],
"options":[ [evidensia-regtwo-productid] ]
}
[/cred_generic_field]
But the class, "skjul" is not added in the frontend.
Hi Jakob, I tried replicating the styling issue but it didn't happen on my local test. Can you point me in your site what page and CRED form is this happening?
Regards,
Yuri
Yeah, but I'd like to give that information in a private message.
Sure thing. I'm setting the private fields for your next response here.
Regards,
Yuri.