Developer Question - External Server Needed for Cart Update?

I paid a developer to write custom code for a product where a price would change based on user input. Can I make an AJAX call to my cart API from a custom template javascript within Shopify? I have a developer that is telling me that this is not possible with Shopify and that it has to be a custom app hosted externally on another server using API call. It seems like a simple functionality to just update the cart price with a simple AJAX API call to the cart.

This is the product that the developer updated that is currently being hosted on an external server: https://dalmatiaprinting.com/products/dtf-transfers-by-size

@Dalma3 “from within shopify” No.

Shopify does not host arbitrary executable code or networking in liquid.

Any ajax call or fetch needs to happen client side (the customers browser) from what a theme renders.

:bomb: Which means if the api call requires security like a private non-public api key or Oauth, etc the call should NOT or cannot be made from the browser.

Not understanding a technology and saying something is simple doesn’t just make it so.

Thanks for the super quick response! I guess what im asking is this:

I have a user make inputs on my page similar to this:

https://www.jiffy.com/jiffytransfers-DTF001.html?ac=Transfer

  1. They upload a file with a certain ratio - lets say 1:1 (1 inch x 1 inch)

  2. I have a price per inch (lets say $1)

  3. I need the “total price” or checkout price that saves to the Shopify server to basically reflect whatever the user selects.

so if they select 2x2, it would be 4 square inches and therefor total checkout $4.

Is this something I can do with javascript. I’m not looking for the code, im just asking if this is possible to do client side via JS and not have a build and host a whole separate app just to update this pricing (the image sizing, adjusting prices in real-time - I know I can do all that in javascript - its the updating of the final checkout price that my question revolves around.)

Again, thank you so much for your help!

Here’s a sample code I found using the fetch method to update the checkout price (just some basic code for the concept):


  
  

Price: $1.00

Paul, did you see my clarification below… any thoughts?