AusPost Collections Widget

Highlighted
New Member
5 0 0

Hi,

I am trying to integrate an AusPost Colletions Widget in my checkout.

The widget is good and working, however it doesn't auto fill the address lines on the checkout page once a "parcel address" is select.

I have read documentation that it just requires a callback function to automatically map the "parcel address" into the address fields of checkout.

Can someone help me with this?

 

Here's the preview link - https://wywr2hyv6po3mce9-14256082.shopifypreview.com

 

Below is the code I have embedded in my checkout liquid file.

 

 

    <!-- AusPost Collect Widget Script --> 
    <script src="https://test.collect.auspost.com.au/LocationFinder.min.js"></script>
    <script type="text/javascript">
      const cb = (storeAddress) => { 
                storeAddress = {
                    StoreId:  	'storeDetails.storeId',
                      Line1:    'storeDetails.storeAddress1',
                      Line2:    'storeDetails.storeAddress2',
                      City:     'storeDetails.storeCity',
                      County:   'storeDetails.storeState',
                      Postcode: 'storeDetails.storePostCode'
                  }
        console.log('cb', storeAddress);
          $("#checkout_shipping_address_address1").val(storeDetails.storeAddress1).prop('disabled', true);
          $("#checkout_shipping_address_address2").val(storeDetails.storeAddress2).prop('disabled', true);
          $("#checkout_shipping_address_city").val(storeDetails.storeCity).prop('disabled', true);
          $("#checkout_shipping_address_zip").val(storeDetails.storePostCode).prop('disabled', true);
          $("#checkout_shipping_address_province").val(storeDetails.storeState).prop('disabled', true);
          $("#checkout_shipping_address_country").val("Australia").prop('disabled', true);
      }
      try { LocationFinder.init({ 
        root: 'auspost-widget', 
        apiKey: 'HNI5G41AEMNLETXV01P4FFIF2IDEY53S', 
        apiSecret: '** This is my API Secret Key **', 
        googleApiKey: '** This is my Google API Secret Key **', 
        merchantId: '** This is my Merchant ID **', 
        emailInputId: 'checkout_email_or_phone', 
        callback: cb 
      }); }
      catch { console.warn('Location Finder Library not available') }
    </script>

 

0 Likes
Highlighted
Excursionist
42 2 1

Hello,

I can surely help you.

PM sent. Kindly check it.

 

Regards,

Lauren W.

0 Likes
Highlighted
Trailblazer
377 15 14

Hi @AugustJr 

I hope you're doing great!

I would be happy to work with you. Please give me a suitable time to discuss your requirements.

Also, add me over Skype id- live:jennifer.wcoast or Email- sales@wreximinfotech.com

I look forward to your response!

Stay Well

Thanks!

0 Likes