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

TQLG-392: preselected-shipping-cost #107

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

paulapopDD
Copy link
Contributor

Preselect the cheapest shipping method available if the one set initially on the cart( from previous orders for eg.) is not available anymore.

@@ -1,4 +1,5 @@
<script setup lang="ts">

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change

i think we can delete this line, or? but not that important for me haha

@@ -0,0 +1,27 @@
import type { Schemas } from '@shopware/api-client/api-types';
import { useCart, useCheckout } from "#build/imports";
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
import { useCart, useCheckout } from "#build/imports";

I dont think we need these imports, since we are not in the module

Comment on lines 10 to +11
);
const { preselectShippingMethod } = useShippingMethod();
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
);
const { preselectShippingMethod } = useShippingMethod();
);
const { preselectShippingMethod } = useShippingMethod();

import { useCart, useCheckout } from "#build/imports";

export function useShippingMethod() {

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change


export function useShippingMethod() {

const preselectShippingMethod = async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it makes sense to rename this function to "preselectShippingMethodFallback", since it serves as the fallback in case the usual preselected one is not available (and doesnt include the actual logic for the preselection in the non fallback case)

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

Successfully merging this pull request may close these issues.

3 participants