问题
I would like to setup custom shipping option using RoyalMail collect widget so customer can go through widget and it would return address after customer selection. So we need to map those address fields with customer shipping address fields.
I have tried with checkout-js-sdk but it required considerable effort to create customm checkout from scratch. I am aiming to have a solution to map widget with BigCommerce shipping method using JavaScript or Angular Js.
window.language = {{ langJson 'optimized_checkout' }};
widgetConfigObj = {
viewingOptions:['Grid'],
royalMail: { getRMId: function () { return 'key' } },
deliveryPostCode: 'NG11DB',
defaultRadius: 10,
defaultNbrOfResults: 10,
onOpenWidget: function () {
//document.getElementById('checkout').disabled = true;
},
onLocationSelected : function(localCollect) {
console.log(location.organisationName);
},
onCancelSelection : function() {/*a call back in case of cancelation*/},
};
var stopMusicExt = document.getElementsByClassName('optimizedCheckout-form-checklist-item')[2];
stopMusicExt.onclick = localCollectSelected(widgetConfigObj);
</script>```
来源:https://stackoverflow.com/questions/55346169/bigcommerce-custom-shipping-method-royalmail-widget-for-collect-location