Head's up on the new Tip feature

Sean_McVeigh
New Member
2 0 0

Just a heads up to anyone else who turns on Tips for their online store, you're going to start seeing a bunch of LineItems (graphql specifically, probably with the other APIs too) with a variant & product of NULL.

Instead of reporting the tips as an order-level entry, akin to the shipping amount, or taxes, it looks like Tips were dropped in as a LineItem on the orders, but it has no corresponding product associated.

So just make sure if you have code expecting valid product or variant IDs, it's not gonna break :)

 

I pull all my product/customer/order/tag data down to an offline sql db so I can access the info quicker and more flexibly, and without throttling, and I have an order printer tied to this data as well, and it started misbehaving the other day.. tracked it down to the Tip feature being turned on at checkout.  I ended up with a bunch of "UNKNOWN" items showing up on my printouts, which I tracked down to these tip entries and the null fields.  My workaround for now was to create a Tip item in my store, and in my syncing code, I look for a null variant and then double check the 'name' field for 'Tip' before overriding the variant id with my stand-in tip item.

 

if ($vid == null) {
	// null variants happen when people leave a tip, replace with an actial tip variant id.
	if ($lnode['name'] == 'Tip') {
		$vid = $tipvid;  // looked up previously
	}
}

 

 

0 Likes