Skip to content

Checkout Fields

Module: Magenx_CheckoutFieldsGraphQl · storefront flag features.checkoutFields

Adds two optional fields to the checkout shipping step: an order comment, and a requested delivery date with an optional time slot. Staff see them on the order, in the order grid and in the order email.

Delivery date calendar and order comment on the checkout shipping step
Delivery date and comment on the checkout shipping step.

The shopper picks from dates the server calculates:

  • Lead time: the earliest date, in days from today. 0 allows same-day delivery.
  • Cut-off time: at or after this time, the earliest date moves one day later.
  • Weekdays without delivery, for example Sunday.
  • Closed dates, one YYYY-MM-DD per line.
  • Maximum window: the latest date, in days from today.
  • Time slots: optional code / label rows. Once any slot exists, the shopper must pick one with the date.

All dates are calendar dates in the store timezone (General > Locale Options > Timezone).

The date picker never shows for In-Store Pickup or for virtual orders.

yesno

Shopper picks date + slot

Saved on the cart

Still available
when the order is placed?

Saved on the order
admin view · grid · email

Order refused:
choose another date

The date is checked again when the order is placed. A cut-off can pass while the shopper is on a PayPal or 3-D Secure page, so an outdated date stops the order with “The delivery date … is no longer available. Please choose another date.” instead of recording a date you can’t meet.

  1. Go to Stores > Configuration > Magenx > Checkout Fields. Both features are off by default.
  2. Enable Order Comment and/or Delivery Date, and set the calendar rules.
  3. Set features.checkoutFields to true in magenx.config.ts.
  4. Optional: add the fields to your order email template (below).
  • A Comment & Delivery box on the order view, Information tab.
  • An optional Delivery Date column in the order grid. It is hidden by default; turn it on from the grid’s Columns menu. It can be sorted and filtered.

Three variables are available in order email templates. They are empty when not set, and HTML in the comment is escaped. Add a block like this in Marketing > Email Templates:

{{depend magenx_delivery_date}}
<p><strong>{{trans "Requested delivery"}}:</strong> {{var magenx_delivery_date}}
{{depend magenx_delivery_slot}} — {{var magenx_delivery_slot}}{{/depend}}</p>
{{/depend}}
{{depend magenx_order_note}}
<p><strong>{{trans "Your comment"}}:</strong><br/>{{var magenx_order_note}}</p>
{{/depend}}

Add a comment

  1. The cart says whether comments are on and how long they may be.
  2. The shopper types a note; markup and control characters are removed; an over-long note is refused.
  3. An empty value removes the note.

Request a delivery date

  1. For a physical cart with a delivery method, the cart offers available dates, slots and whether a date is required.
  2. The shopper picks a date and, if slots exist, a slot.
  3. A date not on the list, or a missing slot, is refused.
  4. Switching to a pickup method hides the calendar; a date left on the cart is not carried to the order.

Place the order

  1. Date and slot are checked again against the calendar.
  2. If the cut-off passed meanwhile, placement stops with "The delivery date … is no longer available. Please choose another date."
  3. If a date is required and none is set on a storefront order, placement stops.
  4. Otherwise comment, date and slot are copied to the order.

Merchant and customer read it

  1. The admin order view shows a "Comment & Delivery" box; the order list can show a sortable, filterable delivery date column.
  2. The order email can print the comment, the date in the store's long format and the slot label.
  3. The customer's order history shows the same values.

These always hold:

  • No order records a date that was not available when it was placed.
  • Pickup and virtual orders never carry a delivery date.
  • A stored comment contains no markup or control characters and is never over the limit.
  • Dates are calendar dates and never shift between cart, order, list and email.
  • Available = {today + lead (+1 after cut-off) … today + min(window, 365)} − excluded weekdays − closed dates.
  • "Today" and "now" use the store's time zone.
  • Slot label comes from current settings by code; a removed slot shows its code.
SituationWhat happens
Date chosen before the cut-off, paid after it through a payment redirect.Placement refused with the "no longer available" message.
Shopper switches to pickup after choosing a date.Calendar hidden; no date on the order.
Lead 0, cut-off 14:00, now exactly 14:00.Today not available.
Every date in the window excluded.Empty list; a required date cannot be met and the message says why.
Comment with a script tag.Tag removed before storing.
Slots defined, date sent without slot.Refused.
Slot removed after an order used it.Order shows the code.
Required on, an automated checkout sends no date.Placement refused.
Store time zone differs from server time zone.Store time zone used.
  • Guest and customer carts; delivery dates only for physical carts with a delivery method.
  • Delivery capacity per day or slot.
  • Delivery dates for in-store pickup or virtual orders.
  • Delivery fees by date or slot.
  • Changing comment or date after the order is placed.
  • Delivery dates on orders created in the admin.
Terminal window
composer require magenxcommerce/module-checkout-fields-graph-ql
bin/magento module:enable Magenx_CheckoutFieldsGraphQl
bin/magento setup:upgrade
bin/magento setup:di:compile # production mode only
bin/magento cache:flush
  • PHP ~8.4.0||~8.5.0, Magento 2.4.8.

Stores > Configuration > Magenx > Checkout Fields

Order Comment

SettingDefaultScopeNotes
Enabled
magenx_checkout_fields/order_note/enabled
NoStore viewYes/No. Shows an optional "Order comment" box on the storefront checkout review step. The comment is shown on the admin order view and is available to the order email as {{var magenx_order_note}}.
Maximum Length
magenx_checkout_fields/order_note/max_length
500Store viewText. Shown when Enabled = Yes. Longest comment accepted, in characters. Longer comments are rejected by the API.

Delivery Date

SettingDefaultScopeNotes
Enabled
magenx_checkout_fields/delivery_date/enabled
NoStore viewYes/No. Lets the shopper pick a delivery date (and a time slot, when slots are configured) after choosing a shipping method. Never offered for In-Store Pickup or for virtual orders.
Required
magenx_checkout_fields/delivery_date/required
NoStore viewYes/No. Shown when Enabled = Yes. When Yes, an order cannot be placed without a delivery date. Agent checkouts (UCP / ACP) never send a date, so leave this at No if you sell through AI agents.
Minimum Lead Time (days)
magenx_checkout_fields/delivery_date/lead_days
1Store viewText. Shown when Enabled = Yes. Earliest selectable date, in days from today (store time zone). 0 allows same-day delivery.
Maximum Days Ahead
magenx_checkout_fields/delivery_date/max_days
30Store viewText. Shown when Enabled = Yes. Latest selectable date, in days from today. Capped at 365.
Daily Cut-off Time
magenx_checkout_fields/delivery_date/cutoff_time
emptyStore viewText. Shown when Enabled = Yes. 24-hour HH:MM in the store time zone, e.g. 14:00. Orders placed after it push the earliest date back one day. Leave empty for no cut-off.
No Delivery On
magenx_checkout_fields/delivery_date/excluded_weekdays
0Store viewMultiple select. Shown when Enabled = Yes. Weekdays on which you do not deliver.
Closed Dates
magenx_checkout_fields/delivery_date/blackout_dates
emptyStore viewText area. Shown when Enabled = Yes. Holidays and other dates without delivery, one per line as YYYY-MM-DD. Invalid lines are ignored.
Time Slots
magenx_checkout_fields/delivery_date/slots
emptyStore viewText. Shown when Enabled = Yes. Optional delivery windows. When any are configured the shopper must pick one together with the date. "Code" must be unique and stable (e.g. "morning"); "Label" is shown to the shopper (e.g. "08:00 – 12:00").

Grant these under System > Permissions > User Roles > Role Resources:

ResourceUnderID
Magenx Checkout FieldsStores > Settings > ConfigurationMagenx_CheckoutFieldsGraphQl::config

setCheckoutFieldsOnCart changes only the fields you pass; null or "" clears one. Cart ownership is checked like every stock cart mutation. Cart.checkout_fields.delivery_options is null when delivery dates are off, the cart is virtual, or In-Store Pickup is selected.

Mutations

setCheckoutFieldsOnCart(input: SetCheckoutFieldsOnCartInput!): SetCheckoutFieldsOnCartOutput

Set or clear the order comment and the delivery date / time slot on a cart. A field left out of the input is unchanged; a field passed as null or an empty string is cleared.

ArgumentTypeDescription
inputSetCheckoutFieldsOnCartInput!

Fields added to Magento types

FieldTypeDescription
Cart.checkout_fieldsCartCheckoutFieldsThe order comment and delivery date settings and values for this cart.
CustomerOrder.checkout_fieldsOrderCheckoutFieldsThe order comment and requested delivery date recorded on the order, or null when it has neither.

Types

input SetCheckoutFieldsOnCartInput - The checkout fields to store on a cart.
FieldTypeDescription
cart_idString!The masked cart id.
order_noteStringFree-text order comment. HTML tags are stripped; rejected when longer than `CartCheckoutFields.order_note_max_length`.
delivery_dateStringRequested delivery date as YYYY-MM-DD. Must be one of `DeliveryOptions.available_dates`.
delivery_slotStringThe `code` of one of `DeliveryOptions.slots`. Required together with a date when slots are configured.
type SetCheckoutFieldsOnCartOutput - The updated cart.
FieldTypeDescription
cartCart!
type CartCheckoutFields - Order comment and delivery date for a cart.
FieldTypeDescription
order_note_enabledBoolean!Whether the order comment box is offered.
order_note_max_lengthInt!Longest order comment accepted, in characters.
order_noteStringThe order comment stored on the cart.
delivery_dateStringThe requested delivery date stored on the cart (YYYY-MM-DD).
delivery_slotDeliverySlotThe requested time slot stored on the cart.
delivery_optionsDeliveryOptionsThe selectable delivery dates and slots. Null when delivery dates are disabled, the cart is virtual, or In-Store Pickup is the selected shipping method.
type DeliveryOptions - Selectable delivery dates and time slots, computed in the store time zone.
FieldTypeDescription
requiredBoolean!Whether the order cannot be placed without a delivery date.
available_dates[String!]!Every selectable date (YYYY-MM-DD), ascending. Lead time, cut-off, excluded weekdays and closed dates are already applied.
slots[DeliverySlot!]!Time slots to choose from; empty when the merchant offers none.
type DeliverySlot - A delivery time window.
FieldTypeDescription
codeString!Stable identifier, sent back in `SetCheckoutFieldsOnCartInput.delivery_slot`.
labelString!Shopper-facing label, e.g. "08:00 – 12:00".
type OrderCheckoutFields - Order comment and requested delivery date recorded on an order.
FieldTypeDescription
order_noteStringThe shopper's order comment.
delivery_dateStringThe requested delivery date (YYYY-MM-DD).
delivery_slotDeliverySlotThe requested time slot.
TermMeaning
Order commentFree text from the shopper, stored as plain text.
Delivery dateA calendar date (no time, no time-zone shift) in the store's time zone.
Time slotMerchant-defined window with a stable code and a label, e.g. "08:00 – 12:00".
Lead timeDays from today to the earliest date; 0 = same day.
Cut-offTime of day from which the earliest date moves one day later.
Excluded weekdayWeekday without delivery.
Closed dateA specific date without delivery.
WindowDays from today to the latest date (at most 365).
Available datesEvery date the shopper may choose after all rules.
Pickup methodAny shipping method where the shopper collects the order.