Select Page

WooCommerce Cart Suggestions

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 Cart Suggestions plugin settings follow: admin bar WooCommerce Cart Suggestions.

General

Contains general settings for Cart Suggestions.

  • Custom CSS Class
  • Display position – position on cart page to display suggested products:
    • Before cart table
    • After cart table
    • After cart total
    • Before cart table 2
    • Before cart page content
    • After cart page content
  • Style – visual style of suggested products
    • Default
    • Image
    • Image with Title
    • Image with Title and Price
    • Title
    • Title with Price
    • Slider
    • Slider with Title
  • Products per line – products count, that will be displayed per one line [1-10]
  • Suggestions Title – title before suggested products
  • Max Suggestions Count – maximum count of products, that can be displayed
  • Same product variation – remove variation from suggestions if anothe variation from same product in cart
  • 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.
  • Shortcode
    • [br_cart_suggestion title=”title” type=”default” count=4 add_to_cart=0 slide_count=4] – Display suggested products
    • Parameters:
      • title – text title (text)
      • type – display type(default/image/image_title/image_title_price/title/title_price)
      • count – count of products (number)
      • add_to_cart – display add to cart button (1/0)
      • slide_count – products displayed per line or per slide

Cart Suggestion

Cart Suggestion Setup

  • To create a new cart suggestion follow: admin bar WooCommerce Cart SuggestionsAdd Suggestion.
  • Contiotions:
    • Product
      • Equal
      • Not equal
    • Category
      • Equal
      • Not eqaul
      • Include subcategories
    • Product attribute
      • Equal
      • Not eqaul
      • Select attribute:
        • Tags
        • Product categories
        • Product tags
        • Product shipping classes
        • Product color
        • Product size
        • Brands
      • ==Any==
        • external
        • grouped
        • simple
        • variable
    • Product age
      • Equal
      • Not equal
      • Equal or less
      • Equal or more
      • day(s)
    • Sale price
      • Equal
      • Not eqaul
      • From – To
    • On Sale
      • Yes
      • No
    • Bestsellers
      • Count of product
    • Price
      • Equal
      • Not eqaul
      • From – To
      • Product price
        • With tax
        • Withhout tax
    • Stock status
      • In stock
      • Out of stock
      • On Backorder
    • Stock quantity
      • Equal
      • Not eqaul
      • Equal or less
      • Equal or more
      • Products in stock
      • Backorder allowed
        • Any
        • Yes
        • No
    • Total sales
      • Equal
      • Not eqaul
      • Equal or less
      • Equal or more
      • Count of product
  • Condition Additional Settings
    • Condition Mode
      • Cart – condition will check all products in cart
      • Each product – condition will check each product
  • Cart Suggestion Settings
    • Suggested Products
    • Count – limit count of products that will be used for product list from this suggestion (get random products)

Custom CSS/JS

Contains setting to set custom CSS code that will be added to frontend pages.

  • 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 On Page Load – runs custom Javascript on page load.

Widgets

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

  • Title – widget title
  • Products count – maximum products count, that can be displayed
  • Widget type – visual style of suggested products
    • Default
    • Image
    • Image with Title
    • Image with Title and Price
    • Title
    • Title with Price
    • Slider
    • Slider with Title
  • Add to cart button – display the Add to cart button under products
  • Products per line – products count per line or per slider for slider type [1-10]

Shortcode

[br_cart_suggestion] – shortcode to display suggested products

Options:

  • title -any text that you whant for title
  • type – types of widget:
    • default – like products on your shop
    • image – only products image
    • image_title – products image and title
    • image_title_price – products image, title and price
    • title – only products title
    • title_price – products title and price
  • count – count of products to display
  • add_to_cart – display add to cart button after products
  • slider_count – products count per line or per slider for sliders 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 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-suggestions.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 the 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-suggestions/templates.

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

after_cart ()

Function for displaying suggested products on cart page

Filter Hooks

cart_suggestion_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_suggestion_get_template_part ( $template, $name ) {
//your code here
    return $template;
}

add_filter( 'cart_suggestion_get_template_part', 'change_cart_suggestion_get_template_part', 10, 2 );
?>

cart_suggestion_widget_title

Title for widgets and shortcodes.

Parameters

  1. title – Title for widgets and shortcodes.

Usage

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

add_filter( 'cart_suggestion_widget_title', 'change_cart_suggestion_widget_title' );
?>

cart_suggestion_widget_count

Products count for widgets and shortcodes.

Parameters

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

Usage

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

add_filter( 'cart_suggestion_widget_count', 'change_cart_suggestion_widget_count' );
?>

cart_suggestion_widget_type

Type of widgets and shortcodes.

Parameters

  1. type – type of widgets and shortcodes.

Usage

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

add_filter( 'cart_suggestion_widget_type', 'change_cart_suggestion_widget_type' );
?>

cart_suggestion_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_cart_suggestion_widget_add_to_cart ( $add_to_cart ) {
//your code here
    return $add_to_cart;
}

add_filter( 'cart_suggestion_widget_add_to_cart', 'change_cart_suggestion_widget_add_to_cart' );
?>

cart_suggestion_widget_slider_count

Product count per line or per slide for slider type in widgets and shortcodes.

Parameters

  1. count – products per line

Usage

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

add_filter( 'cart_suggestion_widget_slider_count', 'change_cart_suggestion_widget_slider_count' );
?>

Files

  • woocommerce-cart-suggestions.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
    • 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
    • unslider-min.js – JQuery slider plugin
  • templates – templates for settings, list style and buttons
    • settings.php – plugin settings page
    • widget.php – widget template