Skip to content
Discussion options

You must be logged in to vote

This is achived, No need to use a package for this All I did is redirect to the cart.$lines route through form action

<form
          action={`/cart/${getVariantIdNumericPart(selectedVariant.id)}:${quantity}`}
        >
          <Button
            variant={'darken'}
            className="min-h-[41px] font-semibold text-base w-full"
            aria-label="Buy Now"
            type="submit"
          >
            Buy Now
          </Button>
        </form>
const getVariantIdNumericPart = (variantId: string) => {
  const variantIdSplit = variantId.split('/');
  return variantIdSplit[variantIdSplit.length - 1];
};

There is already a default route created for this purpose

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by aswanth-updot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
1 participant