Run code graphql input problems - only one order line when using ... cast in query

Run code graphql input problems - only one order line when using ... cast in query

peterandersen
Shopify Partner
8 0 4

This is e re-post, of a post on the Shopify Plus community.
https://community.shopify.com/c/shopify-plus/run-code-graphql-input-problems-only-one-order-line-whe... 

I have a run code problem in a flow.
The run code action maps an order before it is pushed to an extern system
If I include this in my graphql input:
 
    discountApplications {
      targetType
      value {
        ... on PricingPercentageValue {
          percentage
        }
      }
      # This cast will break the load of all limeItems
        ... on AutomaticDiscountApplication {
           title
        }
    }
Then only one of the order lines are returned from this section:
    lineItems {
      quantity
      sku
      title
      variant {
        metafields {
          key
          value
        }
      }
      # price_set
      discountedUnitPriceAfterAllDiscountsSet {
        shopMoney {
          amount
          currencyCode
        }
      }
      # total_price
      discountedTotalSet {
        shopMoney {
          amount
          currencyCode
        }
      }
    }
If i remove the discountApplications, all order lines are returned.
I suspect that is is the cast/inline fragment that some how is the proplem.
 
If I do the same in Shopify GraphiQL App, Then all order lines are returned.

The run code action triggered by a order created action.
Replies 5 (5)

paul_n
Shopify Staff
1185 144 278

Thanks, I think you have hit a bug with how we are handling the interface type there. 

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
peterandersen
Shopify Partner
8 0 4

Hi Paul

If you are looking into bug fixing handling types on the run code input - I have an additional observation.

I tried to use a fragment to replace all the prices
E.g.

 

      discountedPriceSet {
          ...MoneyBagFields
      }


Using the fragment

 

fragment MoneyBagFields on MoneyBag { 
  shopMoney { 
    amount 
    currencyCode 
  } 
}

  

In this case no prices was returned.

Either it is a special case of the same bug or a new one .
 

paul_n
Shopify Staff
1185 144 278

Yeah, that just isn't supported. If you directly add them it should work. How many of these types of fields are you trying to add?

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.

ryan_i
Shopify Staff
15 3 4

Do you have a workflow run link that you could DM Paul or I with? Looking for a workflow run that returned fewer line items than you were expecting. Thank you!

- Finding Flow useful? Leave us a review.
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.

jennywills
Shopify Staff
12 4 2

Hi Peterandersen,

 

Thanks for reporting this bug, it should now be fixed and all LineItems should be returned in future runs

To learn more visit the Shopify Help Center or the Community Blog.