mageworx / module-deliverydate-graph-ql

mageworx/module-deliverydate-graph-ql

Graph QL Addon for MageWorx Delivery Date Extension

magento2-module Compatibility: Not yet tested Code Quality: Fail Tests: N/A Security: Pass OSL-3.0, AFL-3.0

MageWorx_DeliveryDateGraphQl

GraphQL API module for Mageworx Magento 2 Delivery Date extension.

Installation

1) Installation using composer (from packagist)

  • Execute the following command: composer require mageworx/module-deliverydate-graph-ql

2) Copy-to-paste method

  • Download this module and upload it to the app/code/MageWorx/DeliveryDateGraphQl directory (create "DeliveryDateGraphQl" first if missing)

How to use

1. The deliveryDate query returns the information about the selected Delivery Date of the specified cart.

Query attribute is defined below:

cart_id: String! - The unique ID of the cart to query.

By default you can use the following attributes:

day: String     - Delivery day, like 2022-05-11
time: String    - Delivery time, like 00:00_23:59
comment: String - Delivery comment given by a customer

Request:

query ($magentoCartId: String!) {
    deliveryDate(cart_id: $magentoCartId) {
        day
        time
        comment
    }
}

Response:

{
    "data": {
        "deliveryDate": {
            "day": "2022-05-11",
            "time": "14:00_16:00",
            "comment": "Hello GraphQL"
        }
    }
}

Note

We are using next variables in our examples:

{
    "magentoCartId": "{{graphQLCartId}}"
}

where {{graphQLCartId}} is string like VVEmRZMaLRgH1NZ7kkZXWJKIfZiIhbvP (masked quote id).


2. The availableDeliveryDates query returns the information about the all available delivery dates (with time) for the cart.

Query attribute is defined below:

cart_id: String!        - The unique ID of the cart to query.
method: String          - Shipping method code in carriercode_methodcode format. Returns the result for all methods if not specified.
start_day_index: Int    - Offset of days from which the calculation starts. Returns the result from tooday if not specified.
end_day_index: Int      - Number of days to calculate. Returns the result till "Max Delivery Period" if not specified (could be different per Delivery Option configuration).

By default you can use the following attributes:

method: String                  - Shipping method code in carriercode_methodcode format.
day_limits: [DeliveryDayLimit]  - List of available limits for that method and cart

DeliveryDayLimit object:

day_index: Int                      - Index of the day from today (from 0).
date_formatted: String              - Date formatted using format selected in store configuration.
date: String                        - Date in standard Y-m-d format.
extra_charge: ExtraCharge           - Extra charge for that day.
time_limits: [DeliveryTimeLimit]    - Limits by time when available.

DeliveryTimeLimit object:

from: String              - Time from in hh:mm format.
to: String                - Time to in hh:mm format.
extra_charge: ExtraCharge - Extra charge for that time slot. Summed up with a surcharge from the delivery day settings.

ExtraCharge object:

amount: Float           - Amount in selected currency (in cart currency).
formatted: String       - Formatted according selected locale (with currency symbol).
currency_symbol: String - Currency symbol.
currency_code: String   - Currency code.

Request:

query ($magentoCartId: String!) {
    availableDeliveryDates(
        cart_id: $magentoCartId
        method: "flatrate_flatrate"
        start_day_index: 2
        end_day_index: 10
    ) {
        method,
        day_limits {
            day_index
            date_formatted
            date
            extra_charge {
                amount
                formatted
                currency_code
                currency_symbol
            }
            time_limits {
                from
                to
                extra_charge {
                    amount
                    formatted
                    currency_code
                    currency_symbol
                }
            }
        }
    }
}

Response:

{
  "data": {
    "availableDeliveryDates": [
      {
        "method": "flatrate_flatrate",
        "day_limits": [
          {
            "day_index": 5,
            "date_formatted": "14-June-2023",
            "date": "2023-06-14",
            "extra_charge": null,
            "time_limits": [
              {
                "from": "09:00",
                "to": "12:00",
                "extra_charge": {
                  "amount": 0,
                  "formatted": "",
                  "currency_code": "EUR",
                  "currency_symbol": "€"
                }
              },
              {
                "from": "11:00",
                "to": "16:00",
                "extra_charge": {
                  "amount": 0,
                  "formatted": "",
                  "currency_code": "EUR",
                  "currency_symbol": "€"
                }
              },
              {
                "from": "15:00",
                "to": "20:00",
                "extra_charge": {
                  "amount": 4.5409,
                  "formatted": "€4.54",
                  "currency_code": "EUR",
                  "currency_symbol": "€"
                }
              }
            ]
          },
          {
            "day_index": 6,
            "date_formatted": "15-June-2023",
            "date": "2023-06-15",
            "extra_charge": null,
            "time_limits": [
              {
                "from": "09:00",
                "to": "12:00",
                "extra_charge": {
                  "amount": 0,
                  "formatted": "",
                  "currency_code": "EUR",
                  "currency_symbol": "€"
                }
              },
              {
                "from": "11:00",
                "to": "16:00",
                "extra_charge": {
                  "amount": 0,
                  "formatted": "",
                  "currency_code": "EUR",
                  "currency_symbol": "€"
                }
              },
              {
                "from": "15:00",
                "to": "20:00",
                "extra_charge": {
                  "amount": 4.5409,
                  "formatted": "€4.54",
                  "currency_code": "EUR",
                  "currency_symbol": "€"
                }
              }
            ]
          }
        ]
      }
    ]
  }
}

3. The setDeliveryDateOnCart mutation allows you to set delivery date and time to the cart.

Syntax:

mutation: {setDeliveryDateOnCart(input: SetDeliveryDateOnCartInput): Cart}

The SetDeliveryDateOnCartInput object must contain the following attributes:

cart_id: String!                    - The unique ID of a `Cart` object.
delivery_date: DeliveryDateInput!   - Selected delivery date, time (optional) and comment (optional).

The DeliveryDateInput object must contain the following attributes:

day: String!    - A string that identifies a delivery day in standard format Y-m-d.
time: String    - A string that identifies a delivery time diapason in "12:00_23:59" fromat. Must be a valid time.
comment: String - Comment for delivery. Any additional information from customer. Visible to customer by default.

Request:

mutation ($magentoCartId: String!) {
    setDeliveryDateOnCart(
        input: {
            cart_id: $magentoCartId,
            delivery_date: {
                day: "2022-05-11"
                time: "14:00_16:00"
                comment: "Hello GraphQL"
            }
        }
    ) {
        delivery_date {
            day
            time
            comment
        }
    }
}

Response:

{
    "data": {
        "setDeliveryDateOnCart": {
            "delivery_date": {
                "day": "2022-05-11",
                "time": "14:00_16:00",
                "comment": "Hello GraphQL"
            }
        }
    }
}

4. The removeDeliveryDateFromCart mutation allows you to remove selected delivery date and time from the cart (if exists).

Syntax:

mutation: {removeDeliveryDateFromCart(cart_id: String!): Cart}

Request:

mutation ($magentoCartId: String!) {
    removeDeliveryDateFromCart (cart_id: $magentoCartId) {
        delivery_date {
            day
            time
            comment
        }
    }
}

Response:

{
    "data": {
        "removeDeliveryDateFromCart": {
            "delivery_date": {
                "day": "",
                "time": "",
                "comment": ""
            }
        }
    }
}

5. The delivery_date object is also available in the Cart type.

By default you can use the following attributes:

day: String     - Delivery day, like 2022-05-11
time: String    - Delivery time, like 00:00_23:59
comment: String - Delivery comment given by a customer

Request

{
  customerCart {
    id
    items {
      id
      product {
        name
        sku
      }
      quantity
    }
    delivery_date {
        day 
        time
        comment
    }
  }
}

Response

{
    "data": {
        "customerCart": {
            "id": "VVEmRZMaLRgH1NZ7kkZXWJKIfZiIhbvP",
            "items": [
                {
                    "id": "37",
                    "product": {
                        "name": "A",
                        "sku": "A"
                    },
                    "quantity": 1
                }
            ],
            "delivery_date": {
                "day": "2022-05-11",
                "time": "14:00_16:00",
                "comment": "Hello GraphQL"
            }
        }
    }
}

No changelog yet

The vendor hasn't published a changelog. Tagged releases appear in the Versions tab.

Versions
Version Stability QA Status Compatibility Released
1.3.0 stable Pass Not yet tested Details 2025-05-13 16:41:51
1.2.0 stable Not tested Not yet tested Details 2023-06-12 11:08:13
1.1.1 stable Not tested Not yet tested Details 2023-03-29 14:38:32
1.1.0 stable Not tested Not yet tested Details 2023-03-16 08:56:56
1.0.0 stable Not tested Not yet tested Details 2022-06-07 17:07:42

Requires 3

Package Constraint
mageworx/module-deliverydate >=1.21
magento/framework >=103
magento/module-graph-ql >=100

Compatibility

Each Magento release line is installed on its supported PHP versions, then the module is built (DI compilation + static-content deploy) and its unit and integration suites are run. The matrix shows the lines and PHP versions the module is confirmed to install and run on. Code-quality results further down (phpstan, phpcs, …) are reported separately and never affect compatibility.

Compatibility matrix (Magento × PHP)
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 not tested not tested
2.4.8 not tested not tested
2.4.9 not tested not tested

Code Quality

Advisory checks against the module's source. Static analysis runs once across the whole module; PHPStan re-runs per Magento + PHP version because resolvable symbols differ between releases. These NEVER affect the Compatibility badge — a phpcs finding can't make a module incompatible.

Static analysis

Coding standards (phpcs), mess detection (phpmd), copy-pasted code (cpd), PHP cross-version compatibility, composer.json validity. Each runs once for the whole module.

Static analysis results
Tool Status Findings Summary
PHPCS Warning 2 2 warnings (ruleset: Magento2)
PHPMD Warning 31 31 rule violations (UnusedFormalParameter:30, MissingImport:1)
Cpd Pass 0
Composer validate Info 4 valid; 4 advisory notes (composer validate --strict)

PHPStan

Type-checks the module's PHP against a real Magento install at the configured gate level. Re-runs per Magento and PHP version because resolvable symbols differ between releases. Cell → details modal.

PHPStan results by Magento and PHP version
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 Error Error
2.4.8 Error Error
2.4.9 Error Error

Tests

Unit and integration suites, run for each applicable Magento and PHP version. A test failure speaks to the module's behaviour, not its compatibility with a Magento line, so it is reported here separately and never reddens the compatibility matrix.

Unit tests

Unit tests results by Magento and PHP version
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 N/A N/A
2.4.8 N/A N/A
2.4.9 N/A N/A

Integration tests

Integration tests results by Magento and PHP version
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 N/A N/A
2.4.8 N/A N/A
2.4.9 N/A N/A

Security

Security checks run directly against the module: an audit of its declared dependencies for known vulnerabilities (composer audit) and a scan of its source for malware and web-shell signatures. Each runs once. A malware detection fails the version outright.

Security results
Tool Status Findings Summary
Composer audit N/A 0 no resolvable dependency tree to audit — Your requirements could not be resolved to an installable set of packages. Problem 1
Malware scan Pass 0
License
OSL-3.0, AFL-3.0

More from mageworx

View vendor
Make it pay

Turn an existing module into recurring revenue.

If you already maintain a Magento 2 module on GitHub or GitLab, listing it on Packagento takes about five minutes. We mirror your tags, handle distribution signing, and route paid licenses through Stripe Connect, so you can keep shipping the way you already do.