WooCommerce Cart Notices

For Users

Installation of Free Version

Plugin installation Method 1:

  1. Download the plugin from berocket.com or wordpress.org.
  2. Open your website’s admin bar and follow: Plugins Add new Upload plugin.
  3. Click on Browser Dialog to open it, select the downloaded zip-file and click Install.
  4. Click on Activate Plugin.

Plugin installation method 2 :  

  1. Download the plugin from berocket.com or wordpress.org.
  2. Access your website using FTP.
  3. Navigate to WordPress/wp-content/plugins folder.
  4. Open the downloaded zip-file and unzip its content and copy the unzipped files to WordPress/wp-content/plugins folder.
  5. Open your website’s admin bar and open Plugins.
  6. Browse to select Plugin and click on Activate.

Settings

To find the WooCommerce Products Compare settings follow: admin bar→ WooCommerce→ Cart Notices.

General

Contains general settings for Cart Notices.

  • Use WC notices – use WooCommerce notices functions. You cannot select pages where notices will be displayed.
  • Disable notices on cart – disable notices on cart page.
  • Disable notices on checkout – disable notices on checkout page.
  • Pages to display notices – pages where notices will be displayed:
    • Add Page
      • [WOO SHOP]
      • [WOO CATEGORIES]
      • [WOO PRODUCTS]
      • Blog
      • Cart
      • Checkout
      • Knowledge Base
      • My account
      • Simple Page
      • Shop
      • Welcome
  • Shortcode – you can use shortcode to display notices [br_cart_notices] to display all notices.

Cart Notices

HTo add a new notice open the Admin Bar of your site and follow BeRocket Cart Notices→ Notices Add Notice. There you wil find the default editor for posts that has everything you need for adding new posts.

Cart Notices Conditions

  • Product
    • Equal
    • Not equal
  • On Sale
    • Yes 
    • No
  • Bestsellers
    • Count of product
  • Price
    • Equal
    • Not equal
    • From
    • To
    • Product price
      • With tax
      • Without tax
  • Stock status
    • In stock
    • Out of stock
    • On Backorder
  • Total Sales
    • Equal
    • Not equal
    • Equal or less
    • Equal or more
    • Count of product
  • Category
    • Equal
    • Not equal
    • Include subcategories
  • Product attribute
    • Equal
    • Not equal
    • Select attribute
      • Tags 
        • ==Any==
        • external
        • grouped
        • simple
        • variable
      • Tags
        • ==Any==
        • exclude-from-catalog
        • exclude-from-search
        • featured
        • outofstock
        • rated-1
        • rated-2
        • rated-3
        • rated-4
        • rated-5
      • Product categories
        • ==Any==
        • Uncategorized
      • Product tags
      • Product shipping classes
  • Product age
    • Equal
    • Not equal
    • Equal or less
    • Equal or more
    • day(s)
  • Sale price
    • Equal
    • Not equal
    • From
    • To
  • Stock quantity
    • Equal
    • Not equal
    • Equal or less
    • Equal or more
    • Products in stock
    • Backorder allowed
      • Any
      • Yes
      • No

Condition Additional settings

  • Condition Mode:
    • Normal (checks each product; displays only one notice for products summary).
    • Cart (checks all products in cart and displays only one notice for cart summary).
    • Each product (checks each products and displays one notice for each product, that matches conditions).

Cart Notice Settings – Notice Type

  • Cart price
  • Time 
  • Products
  • Category 
  • Referer host
  • Cart Price
    • Minimum price – 
    • Maximum price –
    • Price type – Use price tax(VAT) for cart total
    • Products price without tax
    • Products price with tax
    • Variables
      • %price% – required additional cost amount for minimum price
      • %price_total% – notice price
      • %price_cart% – cart total cost
  • Time
    • Minimum time – you can use hours and minutes. Correct time is: “12”, “1:20”, “18:30”
    • Maximum time – you can use hours and minutes. Correct time is: “12”, “1:20”, “18:30”
    • Days of week – days of the week when notice will be displayed
      • Sunday
      • Monday 
      • Tuesday 
      • Wednesday
      • Thursday
      • Friday
      • Saturday
    • Variables
      • %time% – time before deadline
  • Products
    • Required Products – all of these products in cart
    • Blocking Products – nine of these products in cart
    • Minimum quantity of products – maximum quantity of products from list, which must be in cart to show notice
    • Minimum quantity of products – minimum quantity of products from list, which must be in cart to show notice
    • Variables 
      • %product% – list of products that are matching
      • %quantity% – quantity of matching products
      • %quantity_over_min% – quantity of products over minimum
      • %quantity_over_max% – quantity of products under maximum
  • Category – products category, which must contain one of the products in cart
    • If one of matching products has this category
    • Variables 
      • %category% – category name
  • Referer host – previous site referrer

Custom CSS

Custom CSS – field for custom CSS; contains custom CSS code settings to be displayed on the front end pages. Custom CSS is the CSS as you want it to be.

Widgets

This is the WooCommerce Cart Notices Widget. You can place the widget to any widget area like other widgets.

  • Title – widget title

Shortcode

[br_cart_notices] – shortcode to display notices

Options:

  • title – title text
  • display – types of widget to display. You can use multiple values, like these “time, price”. Types of widget:
    • all – displays all notices
    • time – displays Time deadline type
    • price – displays Minimum cart price type
    • product – displays Product in cart type
    • category – displays Category in cart type
    • referer – displays Host referer type

For Developers

Action Hooks

includes/functions.php

br_get_woocommerce_version()

Public function to get WooCommerce version

return string. woocommerce version

br_generate_product_selector($options)

Generate multiple products selector with search field

  • $options – array with options. Elements:
    • option – array with products id
    • block_name – unique name
    • name – name, that is used as fields name. An array must be: “br_tabs[additional_product][products][]”
    • return – if false, then used echo to display HTML code. If true, then return HTML code as string

return string or void. HTML code

woocommerce-cart-notices.php

All of these functions are in the BeRocket_cart_notices class as static functions.

init ()

Function for initializing scripts.

admin_init ()

Function for initializing scripts and settings page in admin bar.

options ()

Add option page to admin menu.

br_get_template_part( $name = ” )

Get template part (for templates like the slider).

  • $name – template name

Default templates are placed in plugins folder  woocommerce-cart-notices/templates.

To rewrite the template in your theme folder create folder with name woocommerce-cart_notices and place new template with identical name in this folder.

Filter Hooks

cart_notices_get_template_part

Template that is used in plugin.

Parameters

  1. template – link to template that will be loaded.
  2. name – template name.

Usage

<?php
function change_cart_notices_get_template_part ( $template, $name ) {
//your code here
    return $template;
}

add_filter( 'cart_notices_get_template_part', 'change_cart_notices_get_template_part', 10, 2 );
?>

br_is_show_price_notice

Displays price notice on page or not.

Parameters

  1. is_show – show current notice, can be true or false
  2. cart_total – total price in cart
  3. max_price – maximum price value
  4. min_price – minimum price value

Usage

<?php
function change_br_is_show_price_notice ( $is_show, $cart_total, $max_price, $min_price ) {
//your code here
    return $is_show;
}

add_filter( 'br_is_show_price_notice', 'change_br_is_show_price_notice', 10, 4 );
?>

br_is_show_time_notice

Displays time notice on page or not.

Parameters

  1. is_show – show current notice, can be true or false
  2. time – current time in minutes
  3. max_time – maximum time in minutes
  4. min_time – minimum time in minutes

Usage

<?php
function change_br_is_show_time_notice ( $is_show, $time, $max_time, $min_time ) {
//your code here
    return $is_show;
}

add_filter( 'br_is_show_time_notice', 'change_br_is_show_time_notice', 10, 4 );
?>

br_is_show_product_notice

Displays products in cart notice on page or not.

Parameters

  1. is_show – show current notice, can be true or false
  2. products_in_cart – array with product IDs in cart
  3. products – array with product IDs, that must be in cart to show notice

Usage

<?php
function change_br_is_show_product_notice ( $is_show, $products_in_cart, $products ) {
//your code here
    return $is_show;
}

add_filter( 'br_is_show_product_notice', 'change_br_is_show_product_notice', 10, 3 );
?>

br_is_show_category_notice

Displays category in cart notice on page or not.

Parameters

  1. is_show – show current notice, can be true or false
  2. categories_in_cart – array with category IDs in cart
  3. category – category ID, that must be in cart to show notice

Usage

<?php
function change_br_is_show_category_notice ( $is_show, $categories_in_cart, $category ) {
//your code here
    return $is_show;
}

add_filter( 'br_is_show_category_notice', 'change_br_is_show_category_notice', 10, 3 );
?>

br_is_show_referer_notice

Display referrer notice on page or not.

Parameters

  1. is_show – show current notice, can be true or false
  2. referrer – string from $_SERVER[‘HTTP_REFERER’] , when customer opens the site
  3. expect_referrer – string that current notice expects

Usage

<?php
function change_br_is_show_referer_notice ( $is_show, $referrer, $expect_referrer ) {
//your code here
    return $is_show;
}

add_filter( 'br_is_show_referer_notice', 'change_br_is_show_referer_notice', 10, 3 );
?>

Files

  • woocommerce-cart-notices.php – main plugin file
  • css – folder with CSS files
    • admin.css – styles for admin bar
    • font-awesome.css – standard Font Awesome styles
  • fonts – Font Awesome fonts
  • includes – folder with additional PHP files
    • functions.php – public functions
    • updater.php – BeRocket Updater for plugins update from BeRocket site
    • widget.php – widget to display notices
  • js – folder with Javascript files
    • admin.js – Javascript for admin panel settings
  • templates – templates for settings and widget
    • settings.php – plugin settings page
    • widget.php – widget template