Spoke too soon. Had another issue with a Guest Order Invoice not loading and returning me the:
Warning!. Critical billing info is missing. Please update your billing info to generate invoice properly. [UPDATE BILLING INFO] button.
However this time I double-checked that Settings > Premium Packages > Ask for billing address was checked : and it was.
OK, turns out it is ***another*** problem with the Country/State linking. On another matter I’ve asked for Technical Support for Country/State linking over 3 weeks ago, so I’m not holding my breath for a WPDM solution anytime soon. Anyway what I think is happening here is that if a buyer chooses a Country that does NOT HAVE a STATE attached, if they do not put anything in that field the Cart code error checking doesn’t catch this and it writes into the database as an empty string:
a:11:{s:10:”first_name”;s:5:”guest”;s:9:”last_name”;s:4:”user”;s:7:”company”;s:0:””;s:7:”country”;s:2:”AI”;s:5:”state”;s:1:”1″;s:9:”address_1″;s:5:”weqwe”;s:9:”address_2″;s:3:”qwe”;s:4:”city”;s:3:”dwd”;s:8:”postcode”;s:4:”1224″;s:5:”phone”;s:0:””;s:11:”order_email”;s:26:”12345@1234567890123.com.au”;}
I tested again with the exact same Billing Details EXCEPT typing ‘somewhere’ the State field and voila: Invoice appears.
a:11:{s:10:”first_name”;s:5:”guest”;s:9:”last_name”;s:4:”user”;s:7:”company”;s:0:””;s:7:”country”;s:2:”AI”;s:5:”state”;s:9:”somewhere”;s:9:”address_1″;s:5:”weqwe”;s:9:”address_2″;s:3:”qwe”;s:4:”city”;s:3:”dwd”;s:8:”postcode”;s:4:”1224″;s:5:”phone”;s:0:””;s:11:”order_email”;s:26:”12345@1234567890123.com.au”;}
So I’m pretty confident it is the empty string causing the invoice error.
I tried manually editing the broken data but simply adding text into the empty “” space it didn’t work until I twigged that the S:# has to match the character count of the next “string”. No idea why they do this, as there are plenty of ways to count string lengths in PHP. but at least you can fix the problem by editing the record directy in the database.
More testing has shown that everything works fine if you choose a Country with States, because even if the User does nothing they always have a default value that gets written.
So that the invoicing error is linked with any Country THAT DOES NOT have any STATES attached to it in Downloads > Premium Package > Taxes.
I tried adding a blank or a text string into the Taxes field, that by default just shows [/ ], but it doesn’t help – so if the user doen’t enter something into the Cart then the code won’t catch it and although the transaction will process you cannot load the Invoice.
What does that all mean?
It means that any purchasers from those countries – guest or logged in – will potentially have problems loading an invoice. To get around this I will simply turn OFF those countries – so they can’t be selected – so I won’t have to deal with the error.
But if you are from one of those Countries, please feel free to try and get WPDM to at least respond to the error 🙂