Code snippets
Last updated
Last updated
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.
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