Skip to content

Commit

Permalink
Fix compatibility declaration PIWOO-478
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaymo committed Aug 6, 2024
1 parent 7ac1657 commit a253dce
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
9 changes: 8 additions & 1 deletion resources/js/mollieBlockIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@ import molliePaymentMethod from './blocks/molliePaymentMethod'
window.onload = (event) => {
const { registerPaymentMethod } = wc.wcBlocksRegistry;
const { checkoutData, defaultFields } = wc.wcSettings.allSettings;
const { billing_address, shipping_address } = checkoutData;
let billing_address, shipping_address;

if (checkoutData) {
({ billing_address, shipping_address } = checkoutData);
} else {
billing_address = {};
shipping_address = {};
}
const { ajaxUrl, filters, gatewayData, availableGateways } = mollieBlockData.gatewayData;
const {useEffect} = wp.element;
const isAppleSession = typeof window.ApplePaySession === "function"
Expand Down
5 changes: 1 addition & 4 deletions src/Assets/MollieCheckoutBlocksSupport.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,6 @@ public static function localizeWCBlocksData($dataService, $gatewayInstances)

public static function gatewayDataForWCBlocks(Data $dataService, array $gatewayInstances): array
{
if (is_admin() && !is_ajax()) {
return [];
}
$filters = $dataService->wooCommerceFiltersForCheckout();
$availableGateways = WC()->payment_gateways()->get_available_payment_gateways();
$availablePaymentMethods = [];
Expand Down Expand Up @@ -141,7 +138,7 @@ public static function gatewayDataForWCBlocks(Data $dataService, array $gatewayI
'DE' => '+49xxxxxxxxx',
'AT' => '+43xxxxxxxxx',
];
$country = WC()->customer->get_billing_country();
$country = WC()->customer ? WC()->customer->get_billing_country() : '';
$phonePlaceholder = in_array($country, array_keys($countryCodes)) ? $countryCodes[$country] : $countryCodes['NL'];
$gatewayData[] = [
'name' => $gatewayKey,
Expand Down

0 comments on commit a253dce

Please sign in to comment.