Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix/shippingMethodSelection #271

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

orbikular
Copy link

🚀 Fix: The shipping method was reset at Guest Checkout

📝 Description

This update ensures that the selected Shipping Method (shippingMethod) is correctly passed to the checkoutPayload. Previously, WooCommerce did not recognize the shipping method during the checkout process, causing potential issues.

🔧 Changes

  • Added shippingMethod to checkoutPayload
    • chosenShippingMethods from the cart is now properly included in the checkoutPayload.

🛠 Affected File(s)

  • useCheckout.ts

📌 Relevant Code Snippet

const { cart, emptyCart, refreshCart } = useCart();
const selectedMethod = cart.value?.chosenShippingMethods;

let checkoutPayload: CheckoutInput = {
  billing,
  shipping,
  shippingMethod: selectedMethod, // ✅ Shipping method is now included
  metaData: orderInput.value.metaData,
  paymentMethod: orderInput.value.paymentMethod.id,
  customerNote: orderInput.value.customerNote,
  shipToDifferentAddress,
  transactionId: orderInput.value.transactionId,
  isPaid,
};

Copy link

netlify bot commented Jan 29, 2025

Deploy Preview for sleepy-chandrasekhar-717c3d ready!

Name Link
🔨 Latest commit 8df863a
🔍 Latest deploy log https://app.netlify.com/sites/sleepy-chandrasekhar-717c3d/deploys/679a3290a9e8990008afe015
😎 Deploy Preview https://deploy-preview-271--sleepy-chandrasekhar-717c3d.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 95
Accessibility: 97
Best Practices: 100
SEO: 100
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

@alexookah alexookah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants