Actions overview
Actions
CheckoutBillAddressSelect
With this action, the customer selects one of their already saved addresses as the billing address for the current order process. The selection is applied immediately; no further confirmation is needed. Usage exampleUseful for displaying a dropdown of their saved addresses to logged-in customers in the checkout, so they can select a billing address with a single click without re-entering data. Parameters
Error codes
Related modules, variables & methods
Example showing how logged-in customers are presented with a dropdown of their saved addresses, through which they can select a billing address.
CheckoutShippingAddressSelect
With this action, the customer selects one of their already saved addresses as the shipping address for the current order process. The action is only relevant if the customer wants to specify a different shipping address. Usage exampleUseful when a customer wants to ship an order to a different address. Parameters
Error codes
Related modules, variables & methods
Example showing how logged-in customers are presented with a dropdown of their saved addresses, through which they can select a shipping address.
CheckoutSetDraftAddress
With this action, an address entered by the customer is temporarily saved without the entries being immediately checked for completeness or correctness. The draft address already affects the available shipping and payment methods, which are adjusted based on the entries (relevant for the OnePage checkout). The address is initially considered a draft and is applied as the binding checkout address only by CheckoutCommitDraftAddress. The address type is specified directly in the action name (bill or shipping).
Usage exampleUseful in the OnePage checkout to continuously cache the entered address without immediately confronting the customer with validation errors. The actual check of the address only takes place when “Buy now” is clicked, via CheckoutCommitDraftAddress. Parameters
Related modules, variables & methods
Example showing how a billing address is cached as a draft without being validated immediately.
CheckoutCommitDraftAddress
With this action, an address draft previously saved via CheckoutSetDraftAddress is validated and applied as the checkout address. The behavior differs depending on the order type:- Guest order - the entered address is checked and, if valid, applied directly for the checkout.
- Order with customer account - the entered address is checked and, if valid, created as a new address in the customer account and selected for the current checkout at the same time.
bill or shipping).
Together with CheckoutSetDraftAddress, this action forms the typical address workflow in the OnePage checkout:CheckoutSetDraftAddress continuously caches the entries (without validation);
CheckoutCommitDraftAddress completes the process.
Usage exampleUseful as the final step in the OnePage checkout. The customer has already entered their address, and only when “Buy now” is clicked is it checked whether all information is correct and complete. Parameters
Error codes
Related modules, variables & methods
Example showing how a billing address draft is validated and applied as the binding checkout address. In case of incorrect entries, the draft is retained and errors are output.
CheckoutUseSameShippingAddress
With this action, it is specified that delivery should be made to the same address as the billing address. A previously entered or selected different shipping address is not deleted but is no longer taken into account for the checkout. Usage exampleUseful for giving the customer the option, e.g., via a checkbox, to equate billing and shipping addresses with a single click without re-entering data. Related modules, variables & methods Example showing how the action is triggered via a hidden form that can be coupled to a checkbox via JavaScript.
CheckoutUseDifferentShippingAddress
With this action, a different shipping address is activated for the checkout. As soon as it has been triggered, the area for selecting or entering a separate shipping address becomes relevant. The action reverses the effect of CheckoutUseSameShippingAddress. Usage exampleUseful when the customer wants an order to be delivered to a different address, e.g., directly to a branch. Related modules, variables & methods Example showing how the action is triggered via a hidden form that can be coupled to a checkbox via JavaScript.
CheckoutAccountTypeSelect
With this action, the account type for the current order process is set. The selected type determines which steps are displayed in the checkout process. Usage exampleUseful on the login page in the checkout context to give the customer the option of ordering as a guest without having to create an account. Parameters
Error codes
Related modules, variables & methods
Example showing how the account type is set to “
guest” to enable a guest order.
CheckoutSetGuestEmail
With this action, the email address for a guest order is set. It is only relevant if the account type has been set to “guest”.
Usage exampleUseful in the checkout when a customer wants to order as a guest and needs to provide their email address for this. Parameters
Error codes
Related modules, variables & methods
Example showing how a guest customer enters their email address in the checkout, including error output on invalid input.
CheckoutShippingMethodUpdate
With this action, the shipping method for the current order process is set. Usage exampleUseful in the checkout to display a list of available shipping methods to the customer, from which they can select one. Parameters
Error codes
Related modules, variables & methods
- $wsCheckout
- $wsCheckout.selectedShippingMethod
- $wsCheckout.isValidShippingMethod()
- $wsCheckout.problems.shippingMethod
CheckoutConfirm
With this action, the order is submitted in a binding manner. It is the final step in the checkout process and requires that all required information (address, payment method, and shipping method) is complete and valid. Usage exampleUseful as the “Buy now” button on the order overview page, through which the customer places the order in a binding manner. Error codes
Related modules, variables & methods
Example showing how the order is submitted in a binding manner via a button, provided that the customer is logged in or identified as a guest.
RefreshPaymentStatus
With this action, the status of a payment is manually refreshed. The action queries the current state and returns it in JSON format. A success message from the payment provider does not yet mean that the payment is valid in the shop. For example, if PayPal reports a successful payment, the shop does not necessarily accept it. If the 3DS check did not go through, the shop rejects the payment for security reasons. In addition, the payment can still fail when the amount is captured. The returned status is therefore the shop’s assessment and not the response from the payment provider. Usage exampleUseful on the waiting page of an online payment. The customer must only be forwarded to the order confirmation once this action reports the payment as completed without errors. If it reports an error or a cancellation, the customer belongs in the error handling. Response The response always contains the field
paymentStatus.
The states correspond to the payment statuses that the REST API also uses for orders and transactions. There they are represented numerically, in this response as text. In addition to the values listed here, the transaction can take on further statuses, for example after a refund in the backend. Therefore treat unknown values in the template as an open status.
Errors in the response
If
paymentStatus has the value error, the response additionally contains the field errors with a list of the errors that occurred.
The list has so far always been empty. Populating it will only be implemented later, but the format is already fixed and can be taken into account in the frontend. Therefore evaluate the error case via the status value
error and not via the length of the list.CheckoutSetFreeFields
With this action, the free checkout fields are set, for example consent to the terms and conditions or a comment field. The action is typically used together withCheckoutConfirm on the order overview page.
Usage exampleUseful on the order overview page to display a checkbox to the customer for consent to the terms and conditions, which must be accepted before submitting the order. Parameters
Error codes
Related modules, variables & methods
Example showing how a terms and conditions checkbox is embedded as a free checkout field.
CheckoutSetPaymentFields
This action saves the additional fields of the selected payment method. For example, the date of birth and phone number can be collected for PayPal “purchase on invoice”. Which fields exist is defined in the configuration underpayment.paymentField. The currently visible fields of a payment method are available in the template under $wsConfig.payments in the fields entry.
Usage exampleUseful on the payment methods page or in the order overview to request the additional fields directly below the selected payment method. Parameters
The action only processes the fields of the currently selected payment method, and only those whose display conditions are met. Each of these fields takes the corresponding value from the request. If a field is missing from the request, the shop saves an empty value for it, or
false for checkboxes. You should therefore submit all visible additional fields of a payment method in a single form.
Error codes
Whether the action already reports these errors when saving is controlled by
checkout.fieldErrorVisibility with showMissingBeforeSubmit and showInvalidBeforeSubmit. When the order is completed with CheckoutConfirm, the shop always checks the additional fields again and aborts with requiredPaymentFieldEmpty or requiredPaymentCheckboxUnchecked if required fields are empty. The error texts are configured under actions.checkoutSetPaymentFields and actions.checkoutConfirm.
Related modules, variables & methods
Example showing how the additional fields of the selected payment method are output depending on the field type and saved on every change. Empty fields are prefilled with the remembered value from the customer account.
If an address or another additional field changes, the number of visible fields can change because their display conditions depend on it. In this case, reload the area with the additional fields, for example after every automatic submission of the form.
CheckoutSetCustomerData
With this action, additional customer data is set in the checkout. The fields are loaded dynamically from the configuration and can be grouped or ungrouped. Usage exampleUseful in the checkout to query configured customer data fields (e.g., company name, phone) that go beyond the standard address. Parameters
Related modules, variables & methods
Example showing how grouped customer data fields are rendered dynamically and errors are output field-specifically:
CheckoutPseudoCCSelect
With this action, the customer selects one of their saved pseudo credit cards for the current order process. The action is exclusively relevant for the Computop credit card integration. Usage exampleUseful in the checkout when the customer wants to use a previously stored credit card without re-entering the card data. The value
0 stands for “do not use a saved card”.
Parameters
Related modules, variables & methods
Example showing how saved credit cards are displayed for selection, including the option to use no card.
CheckoutNewsletterSubscribe
With this action, a customer subscribes to the newsletter during the order process. The action initially only registers the subscription. The shop does not send the double opt-in email until an order has been completed. For payment methods without external payment, this happens directly with the order; for online payment methods such as PayPal, Stripe, or Computop, it happens only after successful payment. If the customer cancels the order, no email is sent. The registered subscription remains in place until an order is completed. This also applies if an order attempt fails, for example because the terms and conditions were not accepted, or if the customer cancels the payment. The action can therefore be submitted at any point in the checkout, including in an earlier step of a multi-step checkout. The registration is cleared when the order is completed. Each call of the action replaces the previous state. If the validation of the data fails, no subscription is registered afterwards. Use the parametersubscribe=off to discard a registered subscription. You can read which subscription is currently registered via $wsCheckout.newsletterSubscription.
If the double opt-in email cannot be sent after the order is completed, the shop logs the error. The order itself is not affected.
For a newsletter subscription independent of an order, use the NewsletterSubscribe action.
Usage exampleUseful in the checkout, for example for a checkbox on the order overview page that the customer uses to subscribe to the newsletter together with their order. Parameters
Error codes
The error texts are maintained in
actions.newsletterSubscribe. If a newsletter field violates a check, the error text of the respective check is output instead. Validation stops at the first error. Only errors of the newsletter fields are reported together.
Related modules, variables & methods
Example of a checkbox in the checkout that the customer can use to register a newsletter subscription. The form is submitted on every change. The checkbox is placed at the end so that validation errors only appear when the customer wants to subscribe. Add further configured required fields, for example salutation or last name, as fields in the form in the same way and prefill them from
$myNewsletterSubscription.fields.
A success message after submitting the action only means that the subscription has been registered. The actual subscription only begins when the order is completed and the shop sends the double opt-in email.
CheckoutStoreIdSelect
With this action, the customer selects a store as the pickup location for the current order process. The action is only relevant if a shipping method of typepickup has been selected. During selection, it is checked whether all products are available in the selected store. If this is not the case, the action is not executed and an error is returned.If no store has been selected, the store from the general session selection is used by default. Usage example
Useful when the customer wants to pick up an order directly in a store and should choose from the available Click & Collect stores in the checkout. Error codes
Related modules, variables & methods
- $wsCheckout
- $wsCheckout.selectedStoreID
- $wsCheckout.selectedShippingMethod
- $wsStores
- $wsStores.loadAllStores()
- $wsConfig.shippingMethods
pickup, a dropdown with all Click & Collect-capable stores. It sets the selected store as the pickup location via CheckoutStoreIdSelect, including error handling for items not available in the selected store.
