Hello,
Your first code can't work since you're trying to access a value which do not "exist" there.
$address->custom_fields['idnumber'];
Your second code has so many issue that it will be complicated to list them all.
But even the first trigger for the test of the "$product->categories" is not right.
You want to create a generator plugin and you need to create a generator plugin.
Here the only trigger you need :
www.hikashop.com/support/documentation/1...er.html#fct_generate
HikaSerial includes various generator plugins, which can be see as "examples".
The random generator plugin is the simple one, then the coupon plugin also create an HikaShop coupon when a serial is created, the series generator uses a context, points generator can read data from the order product, time limited use the "extra data" and the consumption.
Reading data from the address is not the best for the plugin you want.
Item custom fields should be better since its a user input for each elements in the customer cart.
Item custom fields are data available from the order product, just like other elements.
I don't know why you have these "->custom_fields[]" in your code ; HikaShop is not working like that.
As support for HikaSerial I can help you with the usage of HikaSerial or work on fixes if you found bugs.
Your request is more related to custom development ; I understand that you're not a developer but you should start with something simple.
Like generating the serial using already existing values, such as the order_product_id and the increment (since the customer can put multiple products in the cart, you don't want to generate several times the exact same serial).
Then, once you have your first generator ; you will be able to add more complexity, little by little to the final usage of Item custom fields (and then you'll need HikaShop Business).
But, before making the bigger jump, start smaller so you'll have a first result and not a lot of things to handles at the same time.
Regards,