extension not using latest api_version

Hi, im on the process on create an app extension with cart-transform functions. im facing the following problem when trying to update attributes when merging products.

First i create a shopify app with npm init @Shopify_77 [email removed] (Current Shopify CLI version: 3.60.1)

After setting that up a shopify.app.toml file is created that has api_version=‘2024-04’

Then upon creating and extension with shopify app generate extension, an extension is created, but within this one, the shopify.extension.toml file says it uses api_version="2024-01’ which is breaking my app because i require to use new properties that where introduced in 2024-04.

https://shopify.dev/docs/api/functions/reference/cart-transform/graphql/common-objects/mergeoperation

Im trying to use the attribute property of the mergeOperation. This exists in 2024-04 but not on 2024-01. Upon manually changing the api_version in shopify.extension.toml, i expect the file inside generated/api.ts to have the updated mergeOperation attributes allowing for me to use attributes field, but this is not happening.

How can i assure that my extension is in fact at the time of building and deploying using version 2024-04?

Thanks!

I’m having a similar problem with a different function - particularly the product discount function.

The CartLineTarget isn’t available until 2024-07, but the default shopify app generate extension produces an extension with a shopify.extension.toml of 2024-04.

I attempted to update the api_version in the shopify.extension.toml to 2024-07 manually, then regenerated the GraphQL types, but no luck. Still stuck.

Then I tried rebuilding the extension, but again no update.

I found the solution, you need to update the schema after updating the api_version field.

Here’s the documentation on how to do that:

https://shopify.dev/docs/apps/build/functions/input-output#api-versions

  1. Update the api_version in your shopify.extension.toml file

  2. Run shopify app function schema

  3. Run shopify app function typegen

Then your extensions API version will be updated.

Thank you @dylanpierce . This was exactly what was needed.