• I have noticed that leading zeros are being stripped from postcode when CSV is opened in excel. I need this output – 0810 but am getting this 810.

    I have tried creating a custom function and adding an apostrophe at the start. While this works, it is not being recognised when I try to upload the CSV ( into AusPost website ).

    add_filter('woe_get_order_value_my_postcode',function ($value, $order,$fieldname) {
        $value = '\'' . $order->get_shipping_postcode();
        return $value;
    },10,3);

    I have noticed the Phone(Billing) field retains the leading zero when opened in excel. Is there any way to make postcode work the same way?

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author algol.plus

    (@algolplus)

    Hello

    Open CSV in any text editor and you will see “0” .

    You must use Excel’s Text Import Wizard.
    More details https://smallbusiness.chron.com/wrap-text-microsoft-excel-2003-39676.html

    You can’t fix it using any PHP code, please remove it!
    thanks, Alex

    Thread Starter Stoton

    (@stoton1)

    Thanks @algolplus for the link. It can be hard to know if any given postcode is meant to start with a zero so I wanted to avoid editing individual postcodes in the CSV, as this would just require researching suburbs and postcodes.

    Yes i did come to learn that this was an excel issue rather than the CSV itself.

    In any case I have found a workaround. First I save the file as an XLS instead of CSV. Once downloaded I open the XLS and resave it as CSV, this way the zero seems to sort of carry over… sort of because when I open the CSV there is no leading zero, but when I upload the CSV to AusPost it imports correctly and displays the zero. Very strange but it works…thanks again.

    Plugin Author algol.plus

    (@algolplus)

    Hello

    Why can’t you just upload generated CSV without editing in Excel ?

    if AusPost requires quotes for such fields — try checkbox “Force enclosure for all values” inside section “CSV”

    thanks, Alex

    Thread Starter Stoton

    (@stoton1)

    Hi Alex, yeah I forgot to mention. AusPost does not accept the CSV generated by the plugin. I’ve always had to resave it from excel. I’ll try your suggestion and get back to you. Thanks again.

    Thread Starter Stoton

    (@stoton1)

    Hi Alex, I tried importing the plugin generated CSV with ‘Force enclosure for all values’ checked. Below is the response from AusPost. Just to clarify the settings I am using do not have any custom php added through ‘Misc settings’. When I open the CSV all headers are present.

    Error message:

    Error file log
    Row 1
    Oops! Looks like your CSV file is missing column names. Please include all column names and try again.

    Plugin Author algol.plus

    (@algolplus)

    Hello

    Does AusPost provide sample CSV ?
    Can you share it ?

    Thread Starter Stoton

    (@stoton1)

    Yes they do. How can I send it to you?

    Plugin Author algol.plus

    (@algolplus)

    you can upload it as new ticket to https://algolplus.freshdesk.com/

    Thread Starter Stoton

    (@stoton1)

    No worries, ticket has been opened.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Leading Zero’ is closed to new replies.