hyva-themes / magento2-react-checkout

Highly Customizable Checkout for Magento 2, Built with React.
BSD 3-Clause "New" or "Revised" License
178 stars 53 forks source link

fix for swapping setting billing and shipping #286

Closed jladmore closed 2 years ago

jladmore commented 2 years ago

I found a problem when you open checkout and login to M2 from the checkout itself

You get the error which is something like... can't set billing address same as shipping address when shipping address has not been set. The problem is that the billing address is not set and hence you can't checkout.

I found the place where this is set and swapped the order.. so the shipping is set first and then billing and now all seems ok. I don't think there are any other occurrences of this. ~jono

midhung123 commented 2 years ago

@jladmore I am also facing this issue is this will solve the issue permanently?

rajeev-k-tomy commented 2 years ago

@jladmore Thanks for your contribution. Accepting this change now. However, we need to perform a production build after this.

Also, there is some refactoring needed in the changed file though. We don't need to perform both shipping and billing address update in the case billing = shipping. We can just use billing address save with the indication of both addresses are same.

jladmore commented 2 years ago

@jladmore I am also facing this issue is this will solve the issue permanently?

After fixing I haven't seen again.

midhung123 commented 2 years ago

thanks @jladmore let me check

midhung123 commented 2 years ago

Thanks @jladmore it is also working for me after implementing this fix but I have one more question is it possible to extend this file and apply this fix for the extended file as we working on Magento files?

rajeev-k-tomy commented 2 years ago

@midhung123 Check this out: https://github.com/hyva-themes/magento2-checkout-example

midhung123 commented 2 years ago

Thanks @rajeev-k-tomy it's really helpful

midhung123 commented 2 years ago

In the case of guest users, it is fine but I have met with the same issue when I checkout with a customer account

jladmore commented 2 years ago

I just tested this, and didn't seem to have a problem. What are the exact steps you went through? ~jono

Crayons Retail Pty Ltd Unit 3C/137-139 Silverwater Road Silverwater, NSW, Australia email: @.*** phone: 1300 232 111 mob: +61 401 890 256 skype: jonathonladmore

On Thu, 4 Aug 2022 at 16:07, 'midhung123' via Sales @.***> wrote:

In the case of guest users, it is fine but I have met with the same issue when I checkout with a customer account

— Reply to this email directly, view it on GitHub https://github.com/hyva-themes/magento2-react-checkout/pull/286#issuecomment-1204800967, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPFLIQGNRI6PTPOJL22XYLVXNMYXANCNFSM5XXEXI6Q . You are receiving this because you were mentioned.Message ID: @.***>

midhung123 commented 2 years ago

I tried in two ways first one was just to rearrange the code that is await saveShippingPromise(); await saveBillingPromise(), and run Magento commands it worked for me in the case of guests but not for customers and also extended the file in my module /HyvaCheckout/reactapp/src/components/shippingAddress/hooks/useFillDefaultAddresses.js and changes done mentioned in the https://github.com/hyva-themes/magento2-checkout-example is it also worked in the case of guest but in the case of customer result is negative. Is anything wrong with my side?