Show shipping methods in paypal if express without review

This commit is contained in:
Alex P 2023-04-25 15:06:24 +03:00
parent 8efa0e6da3
commit 9d638a57e3
No known key found for this signature in database
GPG key ID: 54487A734A204D71
12 changed files with 355 additions and 16 deletions

View file

@ -15,6 +15,7 @@ const PayPalComponent = ({
eventRegistration,
emitResponse,
activePaymentMethod,
shippingData,
}) => {
const {onPaymentSetup} = eventRegistration;
const {responseTypes} = emitResponse;
@ -129,6 +130,16 @@ const PayPalComponent = ({
onClick();
};
let handleShippingChange = null;
if (shippingData.needsShipping && !config.finalReviewEnabled) {
handleShippingChange = (data) => {
console.log(data)
const shippingOptionId = data.selected_shipping_option.id;
shippingData.setSelectedRates(shippingOptionId)
};
}
useEffect(() => {
if (activePaymentMethod !== config.id) {
return;
@ -187,6 +198,7 @@ const PayPalComponent = ({
onError={onClose}
createOrder={createOrder}
onApprove={handleApprove}
onShippingChange={handleShippingChange}
/>
);
}