Merchant Guide
Getting Started
To enable the Account Widget in your storefront, please see the following instructions.
Enable the feature for your Inveterate account
Log into the Inveterate Merchant Dashboard and in the main navigation click the "Widget" item. On the page that opens, click the button to turn the feature on and you will then be redirected to the actual "Settings" subpage. If you see editable settings, you have successfully enabled the feature for your account.
Enable customer login via Multipass
Enable customer login via multipass - After enabling the feature, you will be directed to the Multipass Settings subpage. To enable customer login, you will need to provide your Multipass Secret. This is a required step to use the widget. To find your multipass secret:
Open your Shopify admin
Navigate to Settings > Customer Accounts
Make sure Legacy is selected
Scroll down to the Legacy customer account settings
Enable Multipass if it's not already enabled
Copy the secret and paste it into the Shopify Multipass Secret field in the Inveterate merchant dashboard and save


Add widget JS/CSS to your site
It is best to do this in a theme that isn't live to your customers so that you can test it before releasing it. In your Shopify admin on the Online Store page, go to your main theme and click "Duplicate". This will create an exact copy with all of your customizations that you can use for this step and the next one.
In the new them you created, select the Edit Code option to be taken to the theme code editor. In the Snippets folder, create a new file called inveterate-account-widget.liquid. In that file add the following code snippet:
Save the file and then navigate to the layout/theme.liquid file and add the following code directly above the closing </head> tag.
This will actually the code to your theme, making it available in the frontend.
Finally, you need to update the user account icon to open the widget rather than directing customers to the Shopify account templates. This is theme specific, so this will be a generalized explanation.
You will likely find a file with either "header" or "navigation" in the title. First check the sections folder and then check the snippets folder if you can't find it. Make sure it's a .liquid filetype and not .json when in the sections folder. Then you'll want to find the "customer" or "account" icon and it's surrounding <a> html tag. In the <a> tag, delete everything in the href property and replace it with #iaw_display. Yours will be different, but it should look something similar to:

It's possible, depending on your theme, that there is a second user icon specifically for mobile. If this is the case for your theme, make sure you update that one as well.
Add wishlist stars to product cards
If you intend to use wishlists you need to add a way for your customers to add products to their wishlist. This is the simplest method for adding wishlist stars to product cards, but developers will be able to more deeply integrate this feature into your site.
In the theme you created earlier, create a new file in the snippets folder called inveterate-wishlist-heart.liquid. In that file add the following code snippet:
As a brief explanation of what this file is doing, it's creating a heart icon SVG that when clicked will run the addToWishlist() function provided in the widget frontend API and then open the widget. The file itself takes an iaw_product variable that can be passed into the liquid snippet when it's initialized.
To add this icon to product cards, you will need to locate your product cards file in your theme. This will likely be found in the snippets folder. Then you will need to identify the liquid variable that's being used for the product within the file. In my case, it's called card_product. In your case it may be named differently. Add the following code snippet within the product card code:
As mentioned before, you will need to change card_product to whatever it's named in your theme file. This will add a simple heart icon to your product tiles that when clicked will simply add the product to the customers "main" wishlist and will refresh the page. The addToWishlist() function accepts a callback so your developers can add any success messages or other behavior to occur after the item is either successfully added or not (generally because the item is already in the wishlist).
You could also add this to your product display page, but you will need to modify the code to fit your design.
Add Wishlist Button to PDP
Inveterate is currently in the process of creating a Shopify App Block for PDP wishlist button, so this block of documentation will be made obsolete in the very near future. Since the PDP is where a large portion of customers will add products to the wishlist, we wanted to provide this block of documentation to fill the gap until the app block is released.
To further give your customers the ability to add products to their wishlist, it is also useful to add a button to your product display pages (PDP). Similar to the product cards, the exact way you would add this will depend on your theme.
First, create a new snippet called inveterate-wishlist-button.liquid. In this snippet copy/paste the following code, remembering that you will likely need to update styles depending on your theme:
This code snippet creates a disabled button. Then once it confirms window.IAW has been created, it enables the button. When the customer clicks the button it adds the product to the main wishlist and opens the widget.
To add this to your PDP, this will depend on your theme code, but generally you would either look for the snippet or section file that has the majority of the product page code in it. You would then add this code with the following snippet:
For example, in Shopify's default "Dawn" theme the code can be added to the main-product.liquid file. In our dev store, we added it below the cart buttons:

Customization
To customize the widget, you will find a plethora of settings within the Inveterate Merchant dashboard giving you the ability to add your logo, change colors, edit button styles and more. The widget is also fully integrated into your Shopify storefront so you can add your own custom CSS to make sure the widget perfectly fits your store's aesthetic.
Frontend API
This widget also comes with a small frontend API to allow you to perform certain actions through JavaScript. The methods that are listed here can be found by typing into your browser console: window.IAW.Widget.instance. This will be the prefix for all of the following methods that are listed out. For example, if you want to run the show() method, you would write window.IAW.Widget.instance.show().

Now to explain what each function is
addToWishlist- This is used to add products to the wishlist. You saw an example of this being used earlier in this documentation. It takes 3 arguments:productId,wishlistId, andcallback.productIdis the products numeric Shopify ID.wishlistIdis the ID of the wishlist that can be found in som of the other wishlist based functions. It is recommended for simple implementations to usenullfor this field which will automatically default to the customers "main" or "default" wishlist.callbackis a function that you can create that will run after the item has been added to the wishlist. This is useful if you want to refresh the page or show a success message to the customer.getCustomerWishlistById- This will allow you to pass thewishlistIdto get the details about a specific wishlist.getCustomerWishlists- This will allow you to pull all of the customer's wishlists and all of their information. This is particularly useful if you want to give the customer the option to select which wishlist to add a product to, rather than simply adding to the "main" wishlist.getDefaultWishlistId- Useful for getting the ID of the default wishlist in case you need to use it for other wishlist operations.hide- Will hide the widgetrefresh- Will refresh the widget view. Can be used in scenarios where you change some specific customer information outside of the widget but it won't reflect in the widget without a refresh.show- Will show the widget to the customertoggle- Will either hide or show the widget to the customer depending on it's current visible statetrackProduct- Allows you to manually add a product to the recently viewed section of the "For You" tab. This is tracked automatically when a customer visits a product page. An example of when this function might be used is if your store has a quick buy feature on product cards and you want the opening of the quick buy view to add the product to the recently viewed section, you would then use this function for that. It takes the product handle as it's only argument.
Last updated
Was this helpful?
