Cart: Add a Gift Wrap option
This tutorial is based on Shopify's article on adding a gift wrap option to your cart:
These are the Pipeline specific instructions to help you add the customization. Please note, our support staff cannot support this type of customization. Please follow the instructions carefully and also refer to the Shopify article if you have any questions.
Create a gift-wrap product
First, you will create your gift-wrap option as a product:
- From your Shopify just as you would create any other product:
- You can use your product description to explain what materials will be used to gift-wrap the items.
- Give your gift-wrap product the price that you want to charge for the service. If you want gift wrapping to be free, then set the price of your gift-wrap product to be
- You can upload an image for the product to show your customers what a gift-wrapped order will look like.
Here are some sample images you can use for the product image - Click the links to view image and download:
Save the product after creating.
Create a menu (required)
Important: This step is required or the code will not work. Please do not skip this step.
Next, you will create a menu that points to your gift-wrap product:
From the Shopify Admin -> Navigation:
Choose Add menu to create a new menu:
Call the menu:
Make sure on the handle area, the correct handle is assigned:
Next, create a new menu item - Click on Add menu item:
in the Link area, type-in
That will find the product you created in the first step. Use the Add button to complete:
Save the menu.
Create a code snippet
The next step requires you to create a new code snippet in the Code Editor. Open your code editor:
Before beginning - Create a duplicate of your theme. This is important as we will be adding to your cart.liquid file which is critical to your theme. If there's an error, your cart will not function correctly. A duplicate/backup is necessary when performing code modifications like this.
After making a duplicate, rename the backup theme to easily identify it as a backup before this customization. If you're working on a draft theme, you can use the Actions menu for that theme in your list.
Choose Edit Code from your Theme Editor:
In the Snippets directory, click Add a new snippet:
Call the new snippet:
Complete by using the Create snippet button.
Next, in the code area on the right, paste all the code from this file:
Open that link -> Copy all the code -> Paste into your new Snippet file.
Save the gift-wrapping snippet.
Include the snippet in your cart template
The next step is to include the gift-wrapping snippet in your cart.liquid file. This will add the gift wrapping option into your cart page for the customer.
In the Templates directory, open cart.liquid:
In the code area, use the Find feature (Command-F on Mac, Control-F in Windows) and search for:
That will help you find this line:
Next, we will add some new code above the closing </form> line. To help with that, add a few blank lines above the closing </form> line:
Then, paste the following code into the new area (above the </form> line):
Optional: You can clean-up the alignment of the new code and remove extra blank lines:
Save the file.
Note: If your version of Pipeline does not have a closing </form> in templates/cart.liquid - You will need to add this code to below the section cart reference. Example:
Your store will now be ready to use the new feature. To test, add any product to the cart and look for the new option at the bottom of the page:
Once the checkbox is selected, the gift product will be added to the cart:
I've noticed the code from Shopify does time-out. If you're testing and take too long on the cart page, the cart will empty the products and return you to a blank cart screen. Also, you won't be able to test this in the Theme Editor. Be sure to only test from a preview page of the theme. The theme editor doesn't support the gift wrap script.
Again, please make a duplicate of your theme before you start. We cannot be responsible for your customizations nor can we support this Shopify customization.