Still I don’t know if there’s a better way to get custom order fields.
I realized that. My custom value that started with zero 000123, becomes 123
because getFields() function on simpleCartOrder class converts it to integer if(is_numeric($value)) { $value = (integer) $value; }
I do not understand why it is done
That looks like the best way to do it to me! Casting it to an integer is probably done to make sure the fields get the right type. If you need the zeros before, you could try prefixing your values with another character, and filter that out in your hook.
This came just in time. I have been dealing with an issue but had yet to look under the hood. I have alot of custom fields many of which hold pricing values that are outside of the cart itself as well as item numbers with prefixed 0. I was loosing the prefixed zero as well as all $00.00 were coming up $00.
NOTE: I did attempt to use use a postHook as PMedusa described but the scrub happens after postHook apparently (though I cant see where) because I still had the same float and zero prefix issue. Hacking the code was the only solution I could find. Look forward to a solution that doesn’t involve the need for my hack