For Users

Installation

First way to install plugin:

  1. Download plugin from your BeRocket account
  2. Open your site admin panel and go to Plugins -> Add New -> Upload Plugin
  3. Click Browse and select downloaded zip file and click Install Now
  4. Click Activate Plugin

 

Second way to install plugin:  

  1. Download plugin from your BeRocket account
  2. Open your site via FTP
  3. Go to WordPress folder/wp-content/plugins
  4. Extract files from downloaded zip file and copy extracted folders to plugins folder
  5. Open your site admin panel and go to Plugins
  6. Find WooCommerce Cart Suggestions and click Activate under it

Setup

Create suggestions

  • Open Admin Panel -> WooCommerce -> Cart Suggestions
  • You can select 3 types of suggestion:
    • Default - that will be used for any products in cart
    • Categories -  that will be used for specific category
    • Products - that will be use for specific product

More info about settings

Account/Product Key

BeRocket Account and Product key uses for auto update plugins from BeRocket site.

Where can you find Account Key?

  1. Open BeRocket site and Login (The Login button you can find in header menu)
  2. Go to My Account (The My Account button you can find in header menu)
  3. From right side on page you can find all information about your BeRocket account including Account Key

  4. You can click on account key and copy it
  5. What can you do with Account Key?

Where can you find Product Key?

  1. Open BeRocket site and Login (The Login button you can find in header menu)
  2. Go to My Account (The My Account button you can find in header menu)
  3. Click on key icon on right side from plugin name WooCommerce Products Compare

  4. You can click on Product key and copy it
  5. In left field you can type any notice for this key and click DONE to save
  6. What can you do with Product Key?

Settings

WooCommerce Products Compare have settings in Admin Panel -> WooCommerce -> Cart Suggestions

General

Contains general settings for Suggestions.

  • Style - visual style of suggested products
    • Products per line - products count, that will be displayed on one line
  • Display position - position on cart page to display suggested products
  • Suggestions Title - title before suggested products
  • Max Suggestions Count - maximum count of products, that can be displayed
  • Default Suggestions - Products that will be displayed in suggested, when no other suggestions will be found
  • Categories - Products that will be displayed in suggested, when products from specific category in added to cart
  • Products - Products that will be displayed in suggested, when specific products added to cart

CSS

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

  • Custom CSS - any CSS code, that you want

License

Plugin key - uses for updates plugin from BeRocket site. You can get this on BeRocket site -> My Account page on click key icon

BeRocket Account

BeRocket account settings are in Admin Panel -> Settings -> BeRocket Account.

Contains field for place BeRocket Account Key

Where can you find Account Key?

  1. Copy Account Key from BeRocket site
  2. Paste this key to Account key field
  3. Press Test button
  4. If you use right Account Key you will see

  5. Then press Save button

Widget

The widget from plugin called WooCommerce Cart Suggestions. 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
  • Add to cart button - dsiplay Add to cart button under products or not
  • Products per line - products count per line or per slider for sliders type

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

Filter hooks

cart_suggestion_get_template_part

Template that uses 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 products 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

Products count per line or per slide for sliders 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' );
?>

Functions

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. Must be array, like "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 is in class BeRocket_cart_suggestion as static functions.

init ()

Function for initialize scripts.

admin_init ()

Function for initialize scripts and settings page in admin panel.

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 places in plugins folder woocommerce-cart-suggestions/templates.

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

after_cart ()

Function to display suggested products on cart page

Options

All settings you can find in BeRocket_cart_suggestion class in static variables $defaults.

public static $defaults = array(
        'display_before_cart_table' => '0',
        'display_after_cart_table'  => '1',
        'display_after_cart_total'  => '0',
        'widget_style'              => 'default',
        'slide_count'               => '3',
        'suggestions_title'         => 'Maybe You want something from this...',
        'max_suggestions_count'     => '3',
        'default_suggest'           => array(),
        'category_suggest'          => array(),
        'product_suggest'           => array(),
        'custom_css'                => '',
        'script'                    => array(
            'js_page_load'              => '',
        ),
        'plugin_key'                => '',
    );

Files

  • woocommerce-cart-suggestions.php - main plugin file
  • css - folder with CSS files
    • admin.css - styles for admin panel
    • 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 panel settings
    • colpick.js - JavaScript for color picker in admin panel settings
    • unslider-min.js - JQuery slider plugin
  • templates - templates for settings, list style and buttons
    • settings.php - plugin settings page
    • widget.php - widget template