App Bridge get variantTitle

Sam_Larkin
Shopify Partner
6 0 2

Is there a way to get the variant title from the app bridge on the pos, when I fetch the cart the variantTitle is null?

the docs don't even have the variantTitle listed. I would expect it to be set to something like "Small / White" like the similar field in the storefront api.

 

 

 

 

function load_cart_info()
{
	return new Promise(function(accept,reject,) {

		let Cart = AppBridge.actions.Cart;
		let cart = Cart.create(App);


var unsubscriber = cart.subscribe(Cart.Action.UPDATE, function (payload)
{
	unsubscriber();

	ret = {};
	console.log(payload);
	ret.items= payload.data.lineItems.map(function(elem) {
		return {
			"price":elem.price*100,
			"name":buildLineItemName(elem),
			"product_id":elem.productId,
			"variant_id":elem.variantId,
			"qty":elem.quantity
		};
	});

	ret.price = payload.data.subtotal*100;
	console.log("cart info");
	console.log(ret);
	accept(ret);
});

cart.dispatch(Cart.Action.FETCH);
	});
}

function buildLineItemName(item)
{
	let name = item.title;
	if ("variantTitle" in item && item.variantTitle !== null && item.variantTitle != "Default Title") {
		name += " - " + item.variantTitle;
	}
	return name;
}

 

 

 

 

 

s1.pngs3.pngs2.png

 

 

Replies 0 (0)