FROM CACHE - en_header

Fixed and recurring pricing policies not working.

Solved
d_tehrani
Shopify Partner
56 1 12


Hi.

 

I would like to create a subscription group that will discount 5% on the initial purchase and 10% from the second billing.

I've set the selling plan group's fixed pricing policy to 5% and set the recurring pricing policy to 10% with afterCycle = 1.

But the subscription is kept billing 5% off the price.

 

Appreciate it if someone could tell me what I'm doing wrong here.

Thanks.

Accepted Solution (1)

Accepted Solutions
qc11
Shopify Staff
Shopify Staff
29 9 6

This is an accepted solution.

Hi,

I think there might be some misunderstanding in terms of using the price.
Shopify doesn't automatically transition the contract after a cycle. You might still need to update the price of the contract line after the first cycle.

We store the `computedPrice` on the pricing policy where you could fetch and then apply it:

More info please see here:

View solution in original post

Replies 8 (8)
qc11
Shopify Staff
Shopify Staff
29 9 6

Hi,

 

The way you setup the fixed and recurring billing policy sounds all good to me.

 

Would you be able to offer more details in terms of how it's not working:

Is it when you trying to charge your second order or the pricing policy you fetched doesn't match?

d_tehrani
Shopify Partner
56 1 12

Hi. Thank you for the reply.

Below is the code that I used to create a selling plan group. The fetched pricing policies are correct, but when I try to charge a second order, the discount percentage of the order doesn't match.

mutation sellingPlanGroupCreate($input: SellingPlanGroupInput!, $resources: SellingPlanGroupResourceInput) {
  sellingPlanGroupCreate(input: $input, resources: $resources) {
    sellingPlanGroup {
      id
    }
    userErrors {
      code
      field
      message
    }
  }
}



{
  "resources": {
    "productIds": [
      "gid://shopify/Product/6132261257366"
    ]
  },
  "input": {
    "name": "test",
    "options": [
      "test-option-1"
    ],
    "sellingPlansToCreate": [
      {
        "options": [
          "test-option-1"
        ],
        "billingPolicy": {
          "recurring": {
            "interval": "MONTH",
            "intervalCount": 1
          }
        },
        "deliveryPolicy": {
          "recurring": {
            "interval": "MONTH",
            "intervalCount": 1
          }
        },
        "name": "selling-plan-test",
        "pricingPolicies": [
          {
            "fixed": {
              "adjustmentType": "PERCENTAGE",
              "adjustmentValue": {
                "percentage": 5
              }
            }
          },
          {
            "recurring": {
              "adjustmentType": "PERCENTAGE",
              "adjustmentValue": {
                "percentage": 10
              },
              "afterCycle": 1
            }
          }
        ]
      }
    ]
  }
}

 

 

EllaBrown2021
Excursionist
92 0 9

Have you solved this problem?

qc11
Shopify Staff
Shopify Staff
29 9 6

Hi,

Just want to make sure: did you try to charge the second order by using `subscriptionBillingAttemptCreate`?

d_tehrani
Shopify Partner
56 1 12

Yes.

 

Please tell me if there is any other information you need.

qc11
Shopify Staff
Shopify Staff
29 9 6

This is an accepted solution.

Hi,

I think there might be some misunderstanding in terms of using the price.
Shopify doesn't automatically transition the contract after a cycle. You might still need to update the price of the contract line after the first cycle.

We store the `computedPrice` on the pricing policy where you could fetch and then apply it:

More info please see here:

d_tehrani
Shopify Partner
56 1 12

Hi.

That makes sense.
Just want to make sure, should I update the currentPrice of a subscriptionLine, or the discountAllocation using subscriptionDraftDiscountAdd, after the first cycle?

qc11
Shopify Staff
Shopify Staff
29 9 6

Hi,

`SubscriptionCyclePriceAdjustment.computedPrice` should reflect the final price after applying pricing policy. So updating currentPrice with computedPrice would achieve the goal here.

`discountAllocation` works for the cases that any other discount applied on top of the pricing policy price.