Thursday, 23 July 2020

Shopify - Add optional installation on the cart for shoppers

Problem:  On my Shopify shopping cart, if a buyer is checking out and they have plants/flowers in their cart, I need to offer them the ability to have someone plant for them.

This could have various options such as in furniture, you could offer an assembly service.

Initial Hypothesis: Shopify use Liquid as it's scripting language.  Liquid allows us to combine Liquid with HTML, CSS and JavaScript to get the desired page behavior.  Below is my User Story:

As a shopper I want to be able to add labor to allow me to have my flowers/plants installed/planted so that I know an expert has got my flowers in correctly.

I also need to add the appropriate amount of labor, so if less than 3 plants charge for 1 hr  otherwise charge for 2 hrs.  Shopify has variants allowing me to have a labor product for 1 or 2 hrs.

Resolution:  Amend the cart.liquid cart summary page to allow for Labor to plant for the Shopper to easily be added.

Desired Behavior: 
Add a button to add installation

The optional installation cost for 1 hr is added to the store
Steps to Implement: 
1. Create a new Product in Shopify "Plant for me please".  Add it to a unique collection, mine was "Last Minute Checkout Items".  Add a couple of variants for time/cost as shown below:
2. Go to the Product page and append .xml to the end of the page e.g., https://nurserynearby.co.za/collections/last-minute-checkout-items/products/would-you-like-someone-to-plant-your-plants.xml and get the Variant_Id's, we need these to add the correct amount of labor cost later.
3. Open the cart.liquid file and add the  following logic:




Shopify thoughts

Overview:  Recently, I had two requests for some work around shopping carts/auctions.  I dismissed the first request as it is not what I specialize in.  On the second request, I decided to take the project on at a hugely discounted rate as I felt I did not have expertise in the field.

Shopify: Shopify is an amazing product and eco system, and I have build a great shop on the SaaS Shopify platform in record time.  There are great plug-ins to add functionality such as gift registry's, and Mobile add integration.  I have now been playing with the product, deliver solutions, worked with app vendors, reviewed competitor's, had help from Shopify support and I can honestly say that it is awesome.


Program-ability:

  • There are simple API's that are well documents.  
  • The internal language is Liquid which is basically a UI scripting language.
  • Shopify SaaS has add ins and templates, so look before developing
Liquid:


In the code snippet above I am building custom functionality int he cart checkout to add specific products to allow more sales on the store depending on custom rules provided by the customer.

Mobile:
The templates OOTB or that shop admins can purchase follow responsive design as one would expect.  There are add-ons for iOS and Droid to make native apps, very well priced with good functionality changed on a monthly reoccurring basis (circ $40-100/month).  I need a custom mobile app for both platforms so I'm between choosing to build with Flutter or Blazor.


Friday, 10 July 2020

Power Apps Tracing to App Insights Not Working in edit mode

Overview: Power Apps integrates to directly log to App insights.  This post looks at the issues around Tracing in App insights.

Setup & Verify:
App Insights instance Instrument Key Required, Config you Power App to Trace to App Insights, and create a button to test.
The Monitor Tool is fantastic for tracing all outbound traffic, you no longer need to go to the service and check if Power Apps is reaching.  For example I use to have to look at the APIM Azure App logs for custom Connectors.
I can see all my interactions in Power Apps and travelling out.  This is a massive win for Power Apps so giving Tracing from the front end.

Greg Lindhorst, wrote a post on using the Power Apps Monitor Tool for debugging and performance improvement.

Problem: It normally takes a few minutes (like 2 minutes) to show up in App Insights, it is not showing up after 15 minutes.  Let's see, I've drop the Power Apps team a message and i think it's a bug that has crept in recently.  Today is 10 July 2020.  I've also notice that none of my Session page tracing is showing up in App Insights.

Update: 11 July 2020, the Power Apps behaviour has been on my mind.  I'm in edit mode, and when I publish the app and use it, App Insights logs perfectly.  When in edit mode running the app, even direct traces, no logging into Power Apps.  I did not realise this, but it kind of makes sense.

Resolution: Publish & Run the app, and the Tracing and Power App session tracing shows up in App Insights.

Only when I Run the Published App to my Page Views and Custom Traces get logged in App Insights.