To install the Feedback Widget code into your Shopify site, follow these simple steps:
1. Ybug: Copy your code snippet
Go to your dashboard in Ybug. First select the project from the dropdown menu in the top left corner, go to the widget configuration tab and copy your code snippet:
2. Shopify: Paste your snippet
2.1 Go to your Shopify admin, go to your Current theme and click Edit code.
2.2 In the file editor, go the Layout folder, select the main layout (here in the example it is Layout/theme.liquid
). Paste your code snippet right above the closing </body>
tag.
When finished, do not forget to click the Save button.
2.3 Go to your site (refresh the page if needed) and you should see the Feedback button.
Restricting to admins only
Do you need to show the widget to administrators only?
You should be able to conditionally include the snippet only when the admin is logged in by wrapping Ybug's code in an IF condition like this:
{% if content_for_header contains 'adminBarInjector' %}
/* Your Ybug code here */
{% endif %}
If you need to show the Feedback button in the preview mode as well, add another condition content_for_header contains 'previewBarInjector'
. With both conditions, it would look like this:
{% if content_for_header contains 'adminBarInjector' or content_for_header contains 'previewBarInjector' %}
/* Your Ybug code here */
{% endif %}