Using the Downpay API, you can add or remove products to purchase options with a single API call. For inputs, you will need:
- The id of the purchase option in the app. You can find this ID by editing the relevant purchase option in the app - it is the last part of the URL of the edit page
- The ids of the Shopify product(s) you'd like to add to the option.
The API is in GraphQL.
The query:
mutation addProduct($input: PurchaseOptionGroupAddProductsInput!) {
purchaseOptionGroupAddProducts(input: $input) {
errors {
field
message
}
purchaseOptionGroupId
}
}
The input variables:
{
"input": {
"id": "2591031514",
"productIds": ["7907869130970", "1807928180974"]
}
}
mutation removeProduct($input: PurchaseOptionGroupRemoveProductsInput!) {
purchaseOptionGroupRemoveProducts(input: $input) {
errors {
field
message
}
purchaseOptionGroupId
}
}
{
"input": {
"id": "2591031514",
"productIds": ["7907869130970", "1807928180974"]
}
}