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

[3.x] Skip login checkout step when logged in (PHP Solution) #760

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions resources/js/components/Checkout/CheckoutLogin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ export default {
type: Boolean,
default: true,
},
nextUrl: {
type: String,
default: '',
},
},

data: () => ({
Expand All @@ -29,6 +33,14 @@ export default {
return this.$scopedSlots.default(this)
},

async mounted() {
if (user.value.is_logged_in && config.checkout_steps[config.store_code].length > 1) {
this.$root.submitPartials(this.$el.form).then(() => {
window.Turbo.visit(this.nextUrl)
})
}
},

methods: {
async go() {
if (user.value.is_logged_in) {
Expand Down
2 changes: 1 addition & 1 deletion resources/views/checkout/steps/login.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<checkout-login v-slot="checkoutLogin">
<checkout-login v-slot="checkoutLogin" next-url="{{ route('checkout', ['step' => 'credentials']) }}">
Copy link
Member

Choose a reason for hiding this comment

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

This responsibility should fall within the login page

Doing this in the step causes it to happen on onepage checkouts or other combinations (like done in the checkout theme) as well

<fieldset partial-submit="go" class="flex flex-col gap-3" v-cloak>
<label>
<x-rapidez::label>@lang('Email')</x-rapidez::label>
Expand Down
Loading