Step 1: Select the placeholder option
- Select the last option under the "position" setting in the bar configuration in the App
- Select the “Pin the bar to the position” option
- Scrolling to the very end, and click the "Save" button to save the change
Step 2: Add CTB
- Go to Admin > Online Store > Themes
- Click the "Actions" button on the right-hand side, and select "Edit code"
- Find header.liquid from the left-hand side file list and open it. (Cannot find header.liquid? You are using the legacy version of Canopy Theme. Find theme.liquid instead.)
- Find <div id="toolbar" class="toolbar cf">
- Add following code right after it. Save the changes.
<div id="ctb_placeholder"><script>var ctb_adjusted = false;$( "#ctb_placeholder" ).on( "ctb_fully_loaded", function(event, p1) {if ((p1=='inserted' || p1=='inserted_sticky') && !ctb_adjusted ){ctb_adjusted = true;var ctb_height = $("#epb_background").height();var ctb_height_half = ctb_height / 2;var toolbar_cart_top = parseInt($(".toolbar .toolbar-cart").css("top"));$( ".toolbar.docked .toolbar-cart" ).css("top", "calc(50% + " + ctb_height_half + "px)");}});</script></div>
Step 3: Add CSS
- Find styles.scss.liquid from the left-hand side file list and open it
- Add the following code at the very end of the file. And save the changes.
#epb_background { margin: -19px 0 0 0 !important; }@media (max-width: 767px) { #epb_background { margin: -9px 0 0 0 !important; } }
Enjoy the Countdown Timer Bar
Congratulations. You successfully integrate the Countdown Timer Bar with your Canopy theme.
If you cannot see the Countdown Timer Bar yet. Please double check Step 1 and make sure you save the settings.