Anchor to section titled 'undefined'

subscriptionBillingCycleEditsDelete
mutation

Requires write_own_subscription_contracts access scope. Also: The user must have manage_orders_information permission.

Delete the current and future schedule and contract edits of a list of subscription billing cycles.


Anchor to contractId
contractId
required

The globally-unique identifier of the subscription contract that the billing cycle belongs to.

Select billing cycles to be deleted.


Was this section helpful?

The list of errors that occurred from executing the mutation.


Was this section helpful?

Examples

Hide code
DescriptionCopy
mutation subscriptionBillingCycleEditsDelete($contractId: ID!) {
  subscriptionBillingCycleEditsDelete(contractId: $contractId, targetSelection: ALL) {
    billingCycles {
      cycleStartAt
      cycleEndAt
      cycleIndex
    }
    userErrors {
      field
      message
    }
  }
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2024-01/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "mutation subscriptionBillingCycleEditsDelete($contractId: ID!) { subscriptionBillingCycleEditsDelete(contractId: $contractId, targetSelection: ALL) { billingCycles { cycleStartAt cycleEndAt cycleIndex } userErrors { field message } } }",
 "variables": {
    "contractId": "gid://shopify/SubscriptionContract/398475269"
  }
}'
const { admin } = await authenticate.admin(request);

const response = await admin.graphql(
  `#graphql
  mutation subscriptionBillingCycleEditsDelete($contractId: ID!) {
    subscriptionBillingCycleEditsDelete(contractId: $contractId, targetSelection: ALL) {
      billingCycles {
        cycleStartAt
        cycleEndAt
        cycleIndex
      }
      userErrors {
        field
        message
      }
    }
  }`,
  {
    variables: {
      "contractId": "gid://shopify/SubscriptionContract/398475269"
    },
  },
);

const data = await response.json();
session = ShopifyAPI::Auth::Session.new(
  shop: "your-development-store.myshopify.com",
  access_token: access_token
)
client = ShopifyAPI::Clients::Graphql::Admin.new(
  session: session
)

query = <<~QUERY
  mutation subscriptionBillingCycleEditsDelete($contractId: ID!) {
    subscriptionBillingCycleEditsDelete(contractId: $contractId, targetSelection: ALL) {
      billingCycles {
        cycleStartAt
        cycleEndAt
        cycleIndex
      }
      userErrors {
        field
        message
      }
    }
  }
QUERY

variables = {
  "contractId": "gid://shopify/SubscriptionContract/398475269"
}

response = client.query(query: query, variables: variables)
const client = new shopify.clients.Graphql({session});
const data = await client.query({
  data: {
    "query": `mutation subscriptionBillingCycleEditsDelete($contractId: ID!) {
      subscriptionBillingCycleEditsDelete(contractId: $contractId, targetSelection: ALL) {
        billingCycles {
          cycleStartAt
          cycleEndAt
          cycleIndex
        }
        userErrors {
          field
          message
        }
      }
    }`,
    "variables": {
      "contractId": "gid://shopify/SubscriptionContract/398475269"
    },
  },
});
use Shopify\Clients\Graphql;

$client = new Graphql("your-development-store.myshopify.com", $accessToken);
$query = <<<QUERY
  mutation subscriptionBillingCycleEditsDelete($contractId: ID!) {
    subscriptionBillingCycleEditsDelete(contractId: $contractId, targetSelection: ALL) {
      billingCycles {
        cycleStartAt
        cycleEndAt
        cycleIndex
      }
      userErrors {
        field
        message
      }
    }
  }
QUERY;

$variables = [
  "contractId" => "gid://shopify/SubscriptionContract/398475269",
];

$response = $client->query(["query" => $query, "variables" => $variables]);
Hide code
Input variables
Copy
{
  "contractId": "gid://shopify/SubscriptionContract/398475269"
}
Hide code
Response
JSON
{
  "subscriptionBillingCycleEditsDelete": {
    "billingCycles": [
      {
        "cycleStartAt": "2021-12-15T15:33:01Z",
        "cycleEndAt": "2022-01-01T12:00:00Z",
        "cycleIndex": 1
      }
    ],
    "userErrors": []
  }
}