24th Jul '24
/
1 comment

[WooCommerce] Sticky on Scroll Add to Cart section in Bricks

This Pro tutorial provides the steps to set up a sticky section that fades in when scrolling down and fades away when scrolled to the top.

Since the section will be built in the Bricks editor, we have full control over what elements appear inside it, including at various breakpoints.

The sticky section can be either at the top edge of the browser or at the bottom.

At top:

At bottom:

This tutorial can be implemented in any Bricks Page/template for an on-scroll sticky div and is not WooCommerce specific. That said, in this example we shall show WooCommerce product-specific data like the featured image, title, price and add to cart buttons in the sticky-on-scroll section.

Step 1

We need a way for the user to know that the current product has been added to the cart after they click the add to cart button.

Go to Bricks → Settings → WooCommerce. Toggle on Enable Bricks WooCommerce "Notice" element and save settings.

We will then be able to add a Notice element at the bottom in our sticky section.

Step 2

Edit the single WooCommerce product template with Bricks.

If you don't have one already, you could import this fully-built template and edit it with Bricks.

Make sure that a template condition is set like below:

Copy the JSON code (link below) of the sticky template from our dev site and paste it to bring in the entire Section.

This is a BricksLabs Pro tutorial.

For full access login below or create your BricksLabs Pro account

Get access to all 612 Bricks code tutorials with BricksLabs Pro

Related Tutorials..

Side-by-side WooCommerce Quantity and Add to Cart in Bricks

Side-by-side WooCommerce Quantity and Add to Cart in Bricks

Looking to position the quantity input field and Add to cart button next to each other instead of one below the other in Bricks? Add…
Categories:
Pro
On Sale Ribbon for WooCommerce Products Query Loop in Bricks

On Sale Ribbon for WooCommerce Products Query Loop in Bricks

Showing a SALE ribbon for products that are output using Bricks‘ Query Loop.
Categories:
Pro
Opening Submenus with Click Instead of Hover in Bricks

Opening Submenus with Click Instead of Hover in Bricks

This Pro tutorial provides the code for opening submenus with click instead of hover in Bricks. Step 1 Add this in child theme's style.css: Step…
Categories:
Appending WooCommerce Endpoint Names To My account Page Titles in Bricks

Appending WooCommerce Endpoint Names To My account Page Titles in Bricks

Adding the WooCommerce endpoint names, “Orders”, “Downloads” after the WooCommerce ‘My account’ Page’s title text at the various endpoint URLs.
Categories:
Pro
[WooCommerce] Sale price dates in Bricks

[WooCommerce] Sale price dates in Bricks

Outputting start and end sale price dates (if set) for WooCommerce products.
Categories:
Fix for “Your theme (Bricks Child Theme) contains outdated copies of some WooCommerce template files.”

Fix for “Your theme (Bricks Child Theme) contains outdated copies of some WooCommerce template files.”

Updated on 18 Feb 2023 Users of current (at the time of writing this) Bricks stable version of 1.6.2 and WooCommerce 7.4.0 will likely see…
Categories:
Pro
How to Link to a Specific Tab in Bricks

How to Link to a Specific Tab in Bricks

This Pro tutorial provides the JavaScript code that will automatically switch to the tab when using Nestable Tabs elements based on the "tab" URL parameter…
Categories:
Pro
How to Modify Products Element Query in Bricks to Output Child Products

How to Modify Products Element Query in Bricks to Output Child Products

This Pro tutorial provides the steps to limit WooCommerce products output by Bricks' Products element on single product pages to only the children of the…