Shopify POS SDK with new Shopify POS iPad App

Solved
Highlighted
Shopify Partner
520 38 109

I had a few custom pages that worked in conjunction with Shopify POS on the iPad. Specifically, I implemented Edit Cart custom functionality.  This had all tested out fine late last year. And I just decided to pick the project up again. I chose to upgrade the iPad app to the latest version. Now my custom pages aren't working. 

 

Since I lost the Edit Cart ellipses, I added custom tiles for calling these custom pages. Now my functions fail to complete.

 

I am referencing the https://cdn.shopify.com/s/assets/external/pos_app.js JavaScript resource, and attempting to utilize the ShopifyPOS.fetchCart function. If it returns successfully, then I am invoking the addLineItem function to add a line item to the cart. I haven't had a chance to dig into any documentation about any breaking changes with the new POS and the Shopify POS SDK. 

 

I'll paste the function code below. Any suggestions to help me hone in on what's going on? 

 

function addToCart(vendorId, styleNum, itemDesc, retailPrice, dueDate) {
    jQuery("#loading").show(); 
    ShopifyPOS.fetchCart({
    success: function(cart) {
    cart.addLineItem({
                title: 'Special Order: ' + styleNum + ' | ' + itemDesc + ' | ' + dueDate + ' | ' + vendorId,
		price: retailPrice,
                quantity: 1
                }, {
                success: function(cart) {
		    jQuery("#loading").hide(); 
                    ShopifyPOS.flashNotice("Successfully added Special Order Item to cart");
		    ShopifyPOS.Modal.close();
                    },
                error: function(errors) {
		    jQuery("#loading").hide(); 
                    ShopifyPOS.flashError("Failed to add Special Order Item to cart. Error: " + errors[0].message);
		    ShopifyPOS.Modal.close();
                }
            })
    }});
}
0 Likes
Highlighted
Shopify Partner
520 38 109

This is an accepted solution.

Please disregard. I needed to add the tile for these as apps, not as links. All good!

1 Like