Bricks Boilerplate Documentation
PricingDemo
  • Intro
  • Getting Started
    • Requirements
    • 5 minutes launch ⚡
    • Import into an existing project
  • Basics
    • Inside the package
    • Global Styles
      • General
      • CSS Variables
      • Buttons
      • Utility classes
    • Templates
    • ACF
      • Global topbar
    • Bricks Boilerplate Addon plugin
      • Wishlist
      • Variation swatches
      • Checkout
    • Code snippets
  • Tutorials
    • Blog in 5 minutes
    • Custom Off-canvas cart
    • Off-canvas cart without addon plugin
    • Custom Thank you page
    • Custom Checkout page
    • Custom Cart page
    • My account page
    • Product gallery with thumbnails
    • Custom query for product reviews
  • Advanced
    • Custom slider controls
    • Custom accordions
    • Megamenu
    • GSAP animations
  • Common issues
    • Custom CSS
    • Product galleries
    • Restoring site with WPvivid
Powered by GitBook
On this page
  1. Basics

Code snippets

PreviousCheckoutNextBlog in 5 minutes

Last updated 4 months ago

For simple features that require PHP, we use free Code Snippets plugin but you can replace it with any similar plugin or place the code in the child theme.

You can download them via your account your copy them directly here:

Snippet name
Purpose

Get product gallery image IDs

Function to get the product gallery image IDs for the given product - will be depreceated when Bricks 1.11 is released

Bricks whitelisting

Whitelist all echo functions used in Bricks

Get first image of product gallery

Return the first image of product gallery. This will allows you to show second image alongside featured image of the product in query loop.

Display last order in customer dashboard

Create a shortcode that contains information on the last order

Get customer total order count

Return the total number of orders of customer

Get customer total order sum

Return the total sum of Completed orders of customer

Get order status in order table

Show order status in order table

Add Wishlist endpoint to My account page

Create a custom endpoint for My account page - Wishlist

Get discounted amount

Calculates how much the discount. Regular price minus sale price.

Autocart update on quantity change

Update cart page on quality change

Show product images in My Account - Order details

Display images in Order details

Display active shipping method in cart totals

Display selected shipping method in Cart totals element

Custom product reviews tags

Create dynamic tags related to product reviews.

Get all product gallery images

Returns all product gallery images + featured image so you can use it with Image gallery element

Allow extra custom HTML tags bricks 1.10.3

Whitelist custom HTML tags

Get remaining amount for free shipping

Get remaining amount for free shipping based on Woocommerce settings

Get cart subtotal

Return cart subtotal

Display active shipping method in checkout totals

Display selected shipping methods in checkout total element

Redirect to custom Thank you page

Redirecting customers to custom thank you page

Return order status

Return order status

Set number of days to show "New" badge for products

Set number of days when the product is labelled as "New"

Check if product type is Simple

Check if product category has sub categories

Snippets – Bricks BoilerplateBricks Boilerplate
Logo