How Shopify Scripts work in Storefront API?

matt_mortek
Visitor
2 0 2

Hello, I've a simple question - how Shopify Scripts affects Storefront API? In which API queries does it update prices? 

I've published a new Shopify Script in Script Editor but I don't see it updates anything in API response. Neither in product queries nor in new cart API queries...

Replies 6 (6)

Jason
Shopify Expert
11190 225 2282

Was the Shopify Script published for the Storefront API? You need to specifically set it to work there and will be online storefront only by default.

★ I jump on these forums in my free time to help and share some insights. Not looking to be hired, and not looking for work. http://freakdesign.com.au ★

abeaclark
Shopify Partner
5 0 2

@matt_mortek Were you able to solve this?

 

I have several clients where scripts are not working out our storefront app even after being enabled.

 

We are using the storefront graphql API to create / update carts and checkouts, but never see the scripts run

 

banned

abeaclark
Shopify Partner
5 0 2

We're having the same issue. Unable to get the scripts to run on the storefront graphql. Any ideas?

banned
Yamashou
Shopify Partner
1 0 0

I have the same issue. My apps cart not assign scripts. but web store has correct doing on a cart with scripts. The setting has Online Store and Storefront API. 

スクリーンショット 2022-06-17 17.58.27.png

abeaclark
Shopify Partner
5 0 2

I reached out to support on this. They pretty much said that scripts don't run on the storefront API outside of the online storefront.

 

Seems to contradict their documentation (but admittedly the docs aren't super clear).

 

It's sad b/c it leaves our clients in a hard position.

banned

Lishan
Shopify Partner
13 1 2

I just tried out the following:

  • publish the Shopify cart script with also the Storefront API enabled like @Jason mentioned.
  • use the Shopify Storefront API cartCreate to create a cart
  • open the checkout with the returned checkoutUrl from the cartCreate response. 
  • I land on the checkout page with the cart script applied. 

So yea like mentioned here in the Manage a cart with the Storefront API limitations : "Scripts aren't currently supported in a cart, but they're still applied at checkout."