WooCommerce Products of Day

For Users

Settings

To find WooCommerce Products Compare settings follow admin bar WooCommerce Products of Day.

General

  • Position to display products of day – position on the page, where products of the day will be displayed. Doesn’t work on some WooCommerce pages.
    • Before content
    • After content
    • Before footer

Shortcode

  • [br_products_of_day] – shortcode to display suggested products
    • Parameters:
    • title – title of widget
    • type – types of widgets: or display type:
      • default – like products on your shop
      • slider – products in slider
    • products_count – count of products that will be displayed
    • count_line – products per line/slider
    • random – displays random products with random sorting (0 – disable, 1 – enable) 
    • thumbnails – display products thumbnails (0 – disable, 1 – enable)
    • add_to_cart – display Add to cart button after product for each (0 – disable, 1 – enable)
    • hide_outofstock – hide out of stock products  (0 – disable, 1 – enable)
    • widget_position – widget position that can be used as condition (pos1, pos2, pos3, pos4, pos5, pos6, pos7, pos8, pos9, pos10)
    • Examples:
    • [br_products_of_day title=”Products of day” products_count=4 count_line=2 thumbnails=1 random=1] – display 4 products of day in 2 lines, uses random products from list for current day
    • [br_products_of_day title=”Buy right now” add_to_cart=1 products_count=4 count_line=1 thumbnails=1 type=”slider”] – products of day slider with 1 product per slide with Add to cart button
    • [br_products_of_day title=”Products” hide_outofstock=1 add_to_cart=1 products_count=12 thumbnails=1 count_line=3] – display products like in WooCommerce shop page

Styles

Contains styles for product of day element.

  • Use Global styles – global product block.
  • Use Add to cart button – uses Add to cart button in products of day block.
  • Use Price – price in products of day block.
  • Settings for each block:
    • Text color – text color inside block or button/ Default
    • Text color on mouse over – text color inside block or button, when mouse over this block/ Default
    • Background color – background color for block/ Default
    • Background color on mouse over – background color for block, when mouse over this block/ Default
    • Border color – border color around block/ Default
    • Border color on mouse over – border color around block, when mouse over this block/ Default
    • Border width – border width around a block
      • Top
      • Bottom
      • Left
      • Right
    • Paddings – paddings inside a block 
      • Top
      • Bottom
      • Left
      • Right
    • Border round – corner rounding for border
      • Top-Left
      • Top-Right
      • Bottom-Right
      • Bottom-Left

Products of Day

How do I add a new Products List?

  1. Open the Admin Bar of your site and follow BeRocket Products Of Day.
  2. Click on the Add Products List button.
  3. Select the desired settings and press the Save button.

Add widget WooCommerce Products of Day to the page or use shortcode [br_products_of_day].

Click on the “+” sign below Conditions and select the needed condition. Conditions allow you to add two conditions. Click on “+” button, which is below the Conditions, and select the needed condition: + button, which is outside any blocks, adds new blocks that are connected as OR; + button, which is inside each block, adds new condition as AND.

Conditions

  • Day of week (weekday)
    • Monday – products that will be displayed on Monday
    • Tuesday – products that will be displayed on Tuesday
    • Wednesday – products that will be displayed on Wednesday
    • Thursday – products that will be displayed on Thursday
    • Friday – products that will be displayed on Friday
    • Saturday – products that will be displayed on Saturday
    • Sunday – products that will be displayed on Sunday
  • Widget Position 
    • Position 1 – 10
    • Before content
    • After content 
    • Before footer
  • Day Time
    • From 
    • Till
  • User Status
    • Not Logged In
    • Logged In Customers 
    • Logged In Not Customers
  • User Role
    • Equal
    • Not equal
    • Shop manager
    • Customer 
    • Subscriber
    • Contributor
    • Author
    • Editor 
    • Administrator
  • Shipping Zone
    • Equal
    • Not equal
  • Country 
    • Equal
    • Not equal
    • Select
  • Product In Cart
    • Equal
    • Not equal
    • Enter
  • Page ID
    • Equal
    • Not equal
    • [SHOP PAGE]
    • [PRODUCT PAGE]
    • [PRODUCT CATEGORY PAGE]
    • [PRODUCT TAXONOMIES]
    • [PRODUCT TAGS]
    • Blog (ID: 11)
    • Cart (ID: 6)
    • Checkout (ID: 7)
    • Compare (ID: 314)
    • Knowledge Base (ID: 73)
    • My account (ID: 8)
    • Sample Page (ID: 2)
    • Shop (ID: 5)
    • Welcome (ID: 10)
  • Product Category
    • Equal
    • Not equal 
    • Include subcategories 
  • Product Attribute
    • Equal
    • Not equal
    • Select attribute
    • Tags 
      • ==Any==
      • external
      • grouped
      • simple
      • variable
    • Tags
      • exclude-from-catalog
      • exclude-from-search
      • featured
      • outofstock
      • rated-1 – rated-5
    • Product categories
    • Product tags
    • Product shipping classes
  • Product Search
    • Equal
    • Not equal

Products List Settings

  • Products

CSS/Javascript

  • Disable Font Awesome: do not upload the CSS file for Font Awesome to the site. Disable it only if you do not use Font Awesome icons in widgets or you have Font Awesome in your theme.
  • Font Awesome Version – version of Font Awesome, which will be used in the settings and the front end pages of the shop. Please select the version that is in your theme.
  • 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.
  • Javascript – custom Javascript code, runs custom Javascript on page load.

Widgets

This is the WooCommerce Product of Day widget. You can place this widget to any widget area like other widgets.

  • Title – title text
  • Number of Products – count of products to display
  • Random Products from List – random products from products list for day with random sorting
  • Type – types of widget:
    • Default – as products on your shop page
    • Slider – products in slider
  • Count of Products per line– products count per line or per slide for sliders type
  • Show Thumbnails – display product thumbnails
  • Show Add to Cart button – display Add to cart button after products
  • Show Quick View button – display Quick View button (only if the WooCommerce Product Preview plugin is installed and activated)
  • Hide out of stock products – hide products, that are out of stock

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 use echo to display HTML code. If true, then return HTML code as string

return string or void. HTML code

woocommerce-products-of-day.php

All of these functions are in the BeRocket_cart_suggestion 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-products-of-day/templates.

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

Filter Hooks

products_of_day_get_template_part

Template that is used in the plugin.

Parameters

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

Usage

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

add_filter( 'products_of_day_get_template_part', 'change_products_of_day_get_template_part', 10, 2 );
?>

berocket_products_of_day_user_func

Filter for user functions

Parameters

  1. functions – array with user functions

Usage

<?php
function change_berocket_products_of_day_user_func ( $functions ) {
//your code here
    return $functions;
}

add_filter( 'berocket_products_of_day_user_func', 'change_berocket_products_of_day_user_func' );
?>

products_of_day_widget_title

Title for widgets and shortcodes.

Parameters

  1. title – title for widgets and shortcodes.

Usage

<?php
function change_products_of_day_widget_title ( $title ) {
//your code here
    return $title;
}

add_filter( 'products_of_day_widget_title', 'change_products_of_day_widget_title' );
?>

products_of_day_widget_products_count

Products count for widgets and shortcodes.

Parameters

  1. count – suggested products count, that can be displayed.

Usage

<?php
function change_products_of_day_widget_products_count ( $count ) {
//your code here
    return $count;
}

add_filter( 'products_of_day_widget_products_count', 'change_products_of_day_widget_products_count' );
?>

products_of_day_widget_random

Get products randomly or not for widgets and shortcodes.

Parameters

  1. random – get products randomly (true or false).

Usage

<?php
function change_products_of_day_widget_random ( $random ) {
//your code here
    return $random;
}

add_filter( 'products_of_day_widget_random', 'change_products_of_day_widget_random' );
?>

products_of_day_widget_type

Type of widgets and shortcodes.

Parameters

  1. type – type of widgets and shortcodes.

Usage

<?php
function change_products_of_day_widget_type ( $type ) {
//your code here
    return $type;
}

add_filter( 'products_of_day_widget_type', 'change_products_of_day_widget_type' );
?>

products_of_day_widget_count_line

Products count per line or per slide for sliders type in widgets and shortcodes.

Parameters

  1. count – products per line.

Usage

<?php
function change_products_of_day_widget_count_line ( $count ) {
//your code here
    return $count;
}

add_filter( 'products_of_day_widget_count_line', 'change_products_of_day_widget_count_line' );
?>

products_of_day_widget_thumbnails

Display product thumbnails or not in widgets and shortcodes.

Parameters

  1. thumbnails – can be true or false.

Usage

<?php
function change_products_of_day_widget_thumbnails ( $thumbnails ) {
//your code here
    return $thumbnails;
}

add_filter( 'products_of_day_widget_thumbnails', 'change_products_of_day_widget_thumbnails' );
?>

products_of_day_widget_add_to_cart

Use Add to cart button or not in widgets and shortcodes.

Parameters

  1. add_to_cart – can be true or false.

Usage

<?php
function change_products_of_day_widget_add_to_cart ( $add_to_cart ) {
//your code here
    return $add_to_cart;
}

add_filter( 'products_of_day_widget_add_to_cart', 'change_products_of_day_widget_add_to_cart' );
?>

products_of_day_widget_quick_view

Use Quick View button or not in widgets and shortcodes.

Parameters

  1. quick_view – can be true or false

Usage

<?php
function change_products_of_day_widget_quick_view ( $quick_view ) {
//your code here
    return $quick_view;
}

add_filter( 'products_of_day_widget_quick_view', 'change_products_of_day_widget_quick_view' );
?>

products_of_day_widget_hide_outofstock

Hide out of stock products or not in widgets and shortcodes.

Parameters

  1. hide_out_of_stock – can be true or false.

Usage

<?php
function change_products_of_day_widget_hide_outofstock ( $hide_out_of_stock ) {
//your code here
    return $hide_out_of_stock;
}

add_filter( 'products_of_day_widget_hide_outofstock', 'change_products_of_day_widget_hide_outofstock' );
?>

Files

  • woocommerce-products-of-day.php – main plugin file
  • css – folder with CSS files
    • admin.css – styles for admin bar
    • colpick.css – styles for color picker block
    • font-awesome.css – standard Font Awesome styles
    • frontend.css – styles for frontend
    • unslider.css – JQuery slider plugin 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 suggested products
  • js – folder with Javascript files
    • admin.js – Javascript for admin bar settings
    • colpick.js – Javascript for color picker in admin bar settings
    • frontend.js – Javascript for frontend
    • unslider-min.js – JQuery slider plugin
  • templates – templates for settings and widget
    • settings.php – plugin settings page
    • widget.php – widget template