First delivery date through the selling_plan object?

Danh11
Shopify Partner
82 2 35

Is it possible to get the first scheduled delivery date using the selling_plan object? Or any other way? I'm wanting to access this through cart items.

Replies 4 (4)

ChaseKaneki
Shopify Staff
38 6 3

Hello @Danh11 

 

Thank you for reaching out. If you are attempting to show delivery dates for a products in your cart, then we do have an associated delivery policy that can be accessed.

You can access the delivery policy through selling plan. This would provide you with the cutoff day and interval, which from there you should be able to calculate the first scheduled delivery date. Below is an example for querying for accessing the selling plan's delivery policy.

query {
  sellingPlanGroup(
    id: "gid://shopify/SellingPlanGroup/1"
  ) {
    name
    description
    sellingPlans(first: 1) {
      edges {
        node {
          id
          category
          deliveryPolicy {
            ... on SellingPlanRecurringDeliveryPolicy {
              interval
              cutoff
              anchors {
                day
                month
                cutoffDay
              }
            }
          }
        }
      }
    }
  }
}

 
If you're looking to achieve the delivery date in a different context, or this solution does not resolve your issue, please let me know and I would be more than happy to provide a more suitable answer!

Chase Dougherty
Danh11
Shopify Partner
82 2 35

Ah interesting! I think I posted in the wrong section as I was referring to using liquid objects. Although if I really want to make it work I could grab this with GraphQL. Any way to access it using only liquid?

ChaseKaneki
Shopify Staff
38 6 3

Unfortunately, looking at our liquid setup for selling_plan, I don't see a way to access the delivery_policy. So until we make it available, you will have to grab it through GraphQL. Apologies for the inconvenience. 

Chase Dougherty
Danh11
Shopify Partner
82 2 35

Thanks for looking into it. It would be handy to have access to. In this instance I'm wanting to make the subscription start date clear for the customer in the cart item. Not the end of the world as it can be hard coded, but would have been good!