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)
setCustomerForOrder(ctx: RequestContext, order: Order, input: CreateCustomerInput) => Promise<ErrorResultUnion<SetCustomerForOrderResult, Customer>>;
}
- Implements:
GuestCheckoutStrategy
init
method
(injector: Injector) =>
constructor
method
(options?: DefaultGuestCheckoutStrategyOptions) => DefaultGuestCheckoutStrategy
setCustomerForOrder
method
(ctx: RequestContext, order: Order, input: CreateCustomerInput) => Promise<ErrorResultUnion<SetCustomerForOrderResult, Customer>>
DefaultGuestCheckoutStrategyOptions
Options available for the DefaultGuestCheckoutStrategy.
Signature
interface DefaultGuestCheckoutStrategyOptions {
allowGuestCheckouts?: boolean;
allowGuestCheckoutForRegisteredCustomers?: boolean;
}
allowGuestCheckouts
property
boolean
default:
true
Whether to allow guest checkouts.
allowGuestCheckoutForRegisteredCustomers
property
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.