DefaultGuestCheckoutStrategy
DefaultGuestCheckoutStrategy
The default implementation of the GuestCheckoutStrategy. This strategy allows guest checkouts by default, but can be configured to disallow them.
Example
import { DefaultGuestCheckoutStrategy, VendureConfig } from '@vendure/core';
export const config: VendureConfig = {
orderOptions: {
guestCheckoutStrategy: new DefaultGuestCheckoutStrategy({
allowGuestCheckouts: false,
allowGuestCheckoutForRegisteredCustomers: false,
}),
},
// ...
};
Signature
class DefaultGuestCheckoutStrategy implements GuestCheckoutStrategy {
init(injector: Injector) => ;
constructor(options?: DefaultGuestCheckoutStrategyOptions)
async setCustomerForOrder(ctx: RequestContext, order: Order, input: CreateCustomerInput) => Promise<ErrorResultUnion<SetCustomerForOrderResult, Customer>>;
}
Implements
Members
init
method
type:
(injector: Injector) =>
constructor
method
type:
(options?: DefaultGuestCheckoutStrategyOptions) => DefaultGuestCheckoutStrategy
setCustomerForOrder
method
type:
(ctx: RequestContext, order: Order, input: CreateCustomerInput) => Promise<ErrorResultUnion<SetCustomerForOrderResult, Customer>>
DefaultGuestCheckoutStrategyOptions
Options available for the DefaultGuestCheckoutStrategy.
Signature
interface DefaultGuestCheckoutStrategyOptions {
allowGuestCheckouts?: boolean;
allowGuestCheckoutForRegisteredCustomers?: boolean;
}
Members
allowGuestCheckouts
property
type:
boolean
default:
true
Whether to allow guest checkouts.
allowGuestCheckoutForRegisteredCustomers
property
type:
boolean
default:
false
Whether to allow guest checkouts for customers who already have an account.
Note that when this is enabled, the details provided in the
CreateCustomerInput
will overwrite the existing customer details of the registered customer.