Skip to main content

Problems

Introduction

During processing checkout, some problems might occur. Some of them would need to be solved before placing the order. Saleor aggregates existing checkout problems:

Each problem may require different actions from the customer.

info

Not all potential problems are already ported to problems field. See the list below. The list of supported problems will be extended in future releases.

Checkout.problems

Checkout.problems contains the list of all problems that occurred for the checkout. It also includes the problems that are related to specific lines.

The example below shows query that fetches a Checkout.problems.

query checkout($id: ID) {
checkout(id: $id) {
id
problems {
__typename
... on CheckoutLineProblemInsufficientStock {
availableQuantity
variant {
id
}
line {
id
}
}
... on CheckoutLineProblemVariantNotAvailable {
line {
id
}
}
}
}
}
Expand ▼

CheckoutLine.problems

CheckoutLine.problems contains the list of problems that are strictly related to the specific checkout line. The list of problems will be also attached to Checkout.problems field.

The example below shows query that fetches a CheckoutLine.problems.

query checkout($id: ID) {
checkout(id: $id) {
id
lines {
id
problems {
__typename
... on CheckoutLineProblemInsufficientStock {
availableQuantity
variant {
id
}
line {
id
}
}
... on CheckoutLineProblemVariantNotAvailable {
line {
id
}
}
}
}
}
}
Expand ▼

Problem types

CheckoutLineProblemInsufficientStock

CheckoutLineProblemInsufficientStock - defines the problem where there is not enough stock for the quantity assigned to CheckoutLine. Until resolving the problem, placing the order will not be possible. Mutation for finalizing the checkout like checkoutComplete will return an error INSUFFICIENT_STOCK. The quantity should be reduced to the value that is less or equal to CheckoutLineProblemInsufficientStock.availableQuantity.

query checkout($id: ID) {
checkout(id: $id) {
id
problems {
__typename
... on CheckoutLineProblemInsufficientStock {
availableQuantity
variant {
id
}
line {
id
}
}
}
lines {
id
problems {
__typename
... on CheckoutLineProblemInsufficientStock {
availableQuantity
variant {
id
}
line {
id
}
}
}
}
}
}
Expand ▼

CheckoutLineProblemVariantNotAvailable

CheckoutLineProblemVariantNotAvailable - defines the problem where the attached variant to CheckoutLine is not available for purchase. Until resolving the problem, placing the order will not be possible. Mutation for finalizing the checkout like checkoutComplete will return one of the errors: PRODUCT_NOT_PUBLISHED, PRODUCT_UNAVAILABLE_FOR_PURCHASE, UNAVAILABLE_VARIANT_IN_CHANNEL.

query checkout($id: ID) {
checkout(id: $id) {
id
problems {
__typename
... on CheckoutLineProblemInsufficientStock {
availableQuantity
variant {
id
}
line {
id
}
}
... on CheckoutLineProblemVariantNotAvailable {
line {
id
}
}
}
lines {
id
problems {
__typename
... on CheckoutLineProblemInsufficientStock {
availableQuantity
variant {
id
}
line {
id
}
}
... on CheckoutLineProblemVariantNotAvailable {
line {
id
}
}
}
}
}
}
Expand ▼

Control error flow

In the current way of error handling, some mutations can raise an error that is not related to the requested action. For example, checkoutShippingAddressUpdate can raise INSUFFICIENT_STOCK error. It is raised as some of the ProductVariants attached to Checkout don't have enough stock to finalize the checkout process. By changing the value of the flag useLegacyErrorFlow to false, the errors unrelated to specific actions will not be raised (as in the above example: mutation checkoutShippingAddressUpdate was raising INSUFFICIENT_STOCK error). Instead, the new problem will be listed as Checkout.problems and CheckoutLine.problems (if the problem is related to the CheckoutLine).

caution

Not all potential problems are already ported to the problems field. See the list above. It means that even by switching useLegacyErrorFlow to false, some mutations can raise the error unrelated to the requested action. The list of supported problems will be extended in future releases.

note

The flag useLegacyErrorFlow can be modified by updating the checkoutSettings via channelUpdate mutation.

The flag useLegacyErrorFlow can be also changed via Saleor-dashboard side.