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:




0 comments:

Post a comment