Accessing cart attributes from Pickup Point Delivery option generator function

martin-lacko
Shopify Partner
1 0 0

Hello,

I generated new pickup point delivery generator function using typescript. The graphql schema suggest the cart attributes and other cart properties should be accessible in both run.graphql and fetch.graphql and therefore the data should be available at both of these stages. I've created proof of concept that sets the attribute at the checkout and updated following graphql for fetch and run functions.

 

Fetch:

 

query FetchInput {
  deliveryAddress {
    countryCode
    longitude
    latitude
  }
  cart {
    attribute(key: "expressDelivery") {
      key
      value
    }
    cost {
      totalAmount {
        amount
        currencyCode
      }
    }
    lines {
      quantity
      id
      cost {
        totalAmount {
          amount
          currencyCode
        }
      }
    }
  }
}

 

 

Run:

 

query RunInput {
  fetchResult {
    status
    body
  }
  cart {
    attribute(key: "expressDelivery") {
      key
      value
    }
    cost {
      totalAmount {
        amount
        currencyCode
      }
    }
    lines {
      quantity
      id
      cost {
        totalAmount {
          amount
          currencyCode
        }
      }
    }
  }
}

 


 The addition of cost and lines is there just to see if the issue is attribute specific or I am not getting any data at all about the cart.

After running this I am getting this logged in in the extension logs in the partners dashboard
Run input:

 

{
  "fetchResult": {
    "status": 200,
    "body": "// response of the fetch call"
  },
  "cart": {
    "attribute": null,
    "cost": {
      "totalAmount": {
        "amount": "0.0",
        "currencyCode": "CAD"
      }
    },
    "lines": []
  }
}

 

 Fetch input:

 

{
  "deliveryAddress": {
    "countryCode": "GB",
    "longitude": -1.1516966,
    "latitude": 53.9685834
  },
  "cart": {
    "attribute": null,
    "cost": {
      "totalAmount": {
        "amount": "0.0",
        "currencyCode": "CAD"
      }
    },
    "lines": []
  }
}

 


So my question is, is the pickup point generation function not supposed to be providing access to cart attributes and other cart properties (and therefore the graphql schema is broken as it suggest these properties should be accessible)? Or am I doing something wrong on my side? Maybe I need to add some access scope to be able to see cart data etc?

The goal of this feature is to be able to add specific pickup points only when an attribute is present in the cart.

Thank you!

Replies 0 (0)