Add app to cart drawer
Display Hakuna product protection in your cart drawer by customizing your theme. All you have to do is define a position for the widget, hide some cart elements, and map selectors.
1. Edit theme code
You'll need to edit your theme code to define a position for the widget and hide some cart elements. Here's how to do it using the Shopify Dawn theme:
Open your Shopify admin, and go to Online Store -> Themes
Navigate to your current theme, and click Customize

To open the code editor, click the 3 dots in the upper left-hand corner and select Edit code

In the code editor, navigate to the cart-drawer.liquid file in the Snippets folder (you can use the search to find the correct file more easily)

Paste this code snippet below
{%- for item in cart.items -%}
{% if item.product.vendor == "hakuna" %}
{% assign hideHakunaStyle = "display: none;" %}
{% else %}
{% assign hideHakunaStyle = "" %}
{% endif %}
Add
style="{{ hideHakunaStyle }}"to thecart-itemHTML tag
style="{{ hideHakunaStyle }}"
Add <div id="hakuna-cart-widget"></div> just before </cart-drawer-items>
<div id="hakuna-cart-widget"></div>
2. Map selectors
We use selectors to let our widget know which cart sections to update. The Hakuna Shopify app will automatically map selectors with default values. You will likely need to replace these default selectors with ones specific to your theme for cart elements to update properly.
Find the correct selectors
If you want to try your hand at finding the correct selectors on your own, you can follow the steps below. Please keep in mind that the steps will vary based on your theme code. If you get stuck, please reach out to us. We are more than happy to help you find them.
Input the correct selectors
In your Shopify admin, go to Online Store -> Themes
Navigate to the theme you want to edit, and click Customize
In the lefthand sidebar, click App embeds
Search for Hakuna Embed and then click on it to expand it
In the Cart drawer sections selectors section, replace the default selectors with the correct values:

That's it! Hakuna product protection will now be displayed on your product pages and in the cart drawer.

Last updated




