Shortcodes

YITH Render Barcode

The shortcode [yith_render_barcode] allows you to display a barcode at any location within a page, the parameters of which are:

  • id – Pointing to a specific ID, you will see the barcode object whose ID is equal to the indicated value.
  • hide_if_empty (default: 1): a parameter to be used together with the parameter ID does not show anything if there is not a barcode for the specified ID .
  • value: it allows you to specify a specific value for which display a barcode, used together with the protocol parameter.
  • protocol: it allows you to specify which protocol to use to display the barcode (default: EAN8).

YITH Order Barcode

The shortcode [yith_order_barcode] allows you to view a section with which you can operations on orders.
The parameters of which are:

  • search_type: shows the type of object on which it will implement the actions, the default value is shop_order.
  • capability: (default: ‘manage_woocommerce’) indicates the capabilities necessary to display the result of the shortcode.
  • style: sets the style with which you will see the actions that can be performed on orders, set by default as “buttons”.
  • actions: indicates the actions that can be performed on orders, each share equals one button displayed by the shortcode (search and complete order).

Shortcode - YITH Order Barcode

When the order is completed, a note is added to order (with the name of the user that has done the action), as showed in the picture.

User that has completed the order bu scan

YITH Product Barcode

With this shortcode you can show a text field where the user can enter a barcode value and perform some action, from some custom action like the search to customized actions hooked by third party plugins.

The available parameter are the following:

  • capability: (default: ‘manage_woocommerce’) indicates the capabilities necessary to display the result of the shortcode.
  • actions:(string) A comma separated string with the list of the actions that could be performed on product based on their barcode value.
    Every action will be shown as a button and all custom actions need a third party code to manage the action itself.
    Action available are search and complete order.
    Default: ‘search’

Examples

Show the shortcode area to all the users

You can choose to let everyone see and manage the content area rendered by the shortcode, setting the capability attribute as ‘all’.
The following example will show the shortcode area to everyone.

[yith_product_barcode capability="all"]

The result will be the following(use 994 as value for performing a search on product barcodes):

Example

Show the shortcode area only to user with capability ‘manage_woocommerce’

You can choose to let users see the shortcode area only if they have a specific capability.
The following example will show the shortcode area only to users with ‘manage_woocommerce’ capability.

[yith_product_barcode capability="manage_woocommerce"]

or leaving the capability attribute empty(the default value is ‘manage_woocommerce’

[yith_product_barcode]

The result will be:

Example 2

Show additional buttons in the shortcode area

There is a default action(‘search’) that can be performed on products but it’s possible to add as many buttons, one for every additional actions, allowing third party plugins to manage their custom actions.

The following example will show 4 buttons, labelled ‘search’, ‘increase stock’, ‘decrease stock’ and ‘custom action’.
‘Search’ and stock buttons will really perform a search based on the barcode value entered and increase or decrease the stock value for that given product, as they are built-in actions.

The other button, Custom action (or more buttons if you prefer), will only work if you write a custom code associated with it.

[yith_product_barcode actions="search, increase stock, decrease stock", "custom action"]

The result will be:

barcode increase decrease stock