I want to show right from the start that a vendor is not Verified yet, so I created the non editable on the interface attribute
“Verification” (field name verificacao) with 2 options:
Verified
Pending Verification
Right now after the vendor creates his first service, I must check manually that the Verification is Pending.
Is there a way to make so that the vendor has the attribute already with the option Pending Verification so I only need to change it manually after the vendor verifies his profile?
The reason why this caused a fatal error is because the value cannot be just simple text.
It needs to be a data type, like a bool (true, false), int (number: 1, 2, 3), string(“verified”).
It depends on what kind of field type you are using (Number, Phone, Checkbox, Select etc…)
Thank you Stefan, I tried this new one but nothing shows on new registered vendors…keeps empty
From the first code you proposed me, I understand now I should have used “true” as a value, right? Also I should have created only one option for the attribute (before I had 2 options, pending and verified)
Should the attribute be a select type, non editable on front end, with only one option? I would like to all new vendors have the icon and the text “Verificação Pendente”, just like the image attached.
%icon% %value% position block secundary and page secundary,
how to make a default attribute option non editable on front end so that it already appears after vendor creates first listing?
For example, for the attribute Verification I have 2 options: Pending and Verified. I created it as a select type attribute.
The attribute with its 2 options is filterable.
I would like for the %icon% %value% , in this case the value Pending, to be automatically assigned to all vendors on the block secondary position, and page secondary position.
So only after the vendor verifies his profile, I will change manually to the option Verified. Otherwise the %icon% Pending will be shown as default.
The suggested code snippet should be ok, but please note that there’s the same icon per attribute, not per each attribute option - this would require further customizations.
Nothing was changing on the profile for new vendors, so I followed Stefan suggestion and read his other thread where maybe the problem is that it is not saving the information when vendor creates account from the front end.
If it’s a Select attribute, please use the option ID instead of label in this code snippet:
add_action(
'hivepress/v1/models/vendor/create',
function ($vendor_id, $vendor){
$vendor->set_verificacao(123)->save_verificacao();
},
1000,
2
);
Please replace 123 with the option ID (you can check it in the browser address bar while you edit the ‘Verificação Pendente’ option, it looks like “…tag=123…”).