mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
AXO: Fix state mapping details for shipping details
This commit is contained in:
parent
b43058f13e
commit
94061bb2a5
3 changed files with 17 additions and 5 deletions
|
@ -2,9 +2,9 @@ import FormFieldGroup from "../Components/FormFieldGroup";
|
|||
|
||||
class ShippingView {
|
||||
|
||||
constructor(selector, elements) {
|
||||
constructor(selector, elements, states) {
|
||||
this.el = elements;
|
||||
|
||||
this.states = states;
|
||||
this.group = new FormFieldGroup({
|
||||
baseSelector: '.woocommerce-checkout',
|
||||
contentSelector: selector,
|
||||
|
@ -34,6 +34,10 @@ class ShippingView {
|
|||
</div>
|
||||
`;
|
||||
}
|
||||
const countryCode = data.value('countryCode');
|
||||
const stateCode = data.value('stateCode');
|
||||
const stateName = (this.states[countryCode] && this.states[countryCode][stateCode]) ? this.states[countryCode][stateCode] : stateCode;
|
||||
|
||||
return `
|
||||
<div style="margin-bottom: 20px;">
|
||||
<div class="axo-checkout-header-section">
|
||||
|
@ -45,8 +49,8 @@ class ShippingView {
|
|||
<div>${data.value('firstName')} ${data.value('lastName')}</div>
|
||||
<div>${data.value('street1')}</div>
|
||||
<div>${data.value('street2')}</div>
|
||||
<div>${data.value('city')}, ${valueOfSelect('#billing_state', data.value('stateCode'))} ${data.value('postCode')} </div>
|
||||
<div>${valueOfSelect('#billing_country', data.value('countryCode'))}</div>
|
||||
<div>${data.value('city')}, ${stateName} ${data.value('postCode')}</div>
|
||||
<div>${valueOfSelect('#billing_country', countryCode)}</div>
|
||||
<div>${data.value('phone')}</div>
|
||||
</div>
|
||||
`;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue