The carrier service is missing discounts in rate requests provided

Hi all.

I have a couple of custom apps using the carrier service webhooks.

Up until now, the rate request i get from shopify has included information about both each items price and applied discounts. The discounts were supplied in the “properties” object fields, namely in the data fields, “discounted_price” and “_ro_unformated_price”.

{
"rate":{
"origin":{ ...},
"destination":{ ... },
"items":[
{
"name":"Product 1",
"sku":"123",
"quantity":1,
"grams":500,
"price":71500,
"vendor":"test",
"requires_shipping":true,
"taxable":true,
"fulfillment_service":"manual",
"properties":{
 "discounted_price":"600 kr",
"_ro_unformated_price":"59995"
},
"product_id":123456,
"variant_id":123456
}
],
"currency":"DKK",
"locale":"da-DK"
}
}

}

Now both of these data fields has disappeared, the properties field is just an empty object { }, I have tested multiple shops, and it seems to be a change in Shopify. I know that these fields were not really documented but the carrier service section in general is poorly documented, and discount certainly seem logical to include, since, “what worth does the price have if you cannot know the applied discount” ?

I have asked the support about this, but they seem to be in a “Not our problem” state of mind.

So.. well, anybody else shares this pain, please like, and if you know of any solution to this, how I could get the information about applied discounts, please let me know.

Thanks!

Hi - can you confirm that verify that the discounted_price and _ro_unformated_price are available at the time of checkout?

Hi Liam.

Well, I know the fields were present before because our system relied on them, and I can confirm that they are not present anymore, the properties filed is just a set of empty brackets {}, and as such, no information regarding an applied discount is given in a rate request.

And our problem is that the discount information is absent.

It’s possible some changes could have been made to the carrier service API - I will connect with our internal product team who owns this space and dig into this more.

Normally, the properties field is dynamically modified with a script on your store using AJAX API or changed with the theme’s liquid code. Have you changed your store front code or modified your themes liquid? You can add them using AJAX API “/cart/change.js” or add an input element with name=“properties[discounted_price]”.

These documentations might help:

Cart API reference (shopify.dev)

Liquid objects: line_item (shopify.dev)

product (shopify.dev)

Hi again - it doesn’t look like these properties are added by Shopify on line items. It’s possible a script or application added these. The properties hash is only used for custom properties, and discounts won’t modify it. Instead, a script could use .change_properties to add them, or possibly an app could use the Storefront API’s cartLinesUpdate operation to add them. There’s also the Cart AJAX API, with a /cart/change operation that can update properties. All of these would then carry these additional properties to the price request.

Thanks,. I will look into that..

Ok, so this information could also have be provided by an app, like Bold subscriptions ?

It just seemed logical that one would get information of any applied discount on a rate requests line item from Shopify, particularly because of the limited time you have to react on a rate request. It would be a hazard to look i t up any other way.