Uni CPO 4 Documentation
  • Introduction
  • Why Uni CPO?
  • Installation
    • Upgrade
  • How To Use
    • Plugin's Settings
    • Builder
      • Data Structure
      • General Settings
      • Non Option Variable (NOV)
      • Weight Conditional Logic
      • Dimensions Settings
      • Image Conditional Logic
      • Formula Conditional Logic
      • Dynamic labels for options/suboptions
      • Shipping Classes Conditional Logic
      • Cart Discounts
    • Basic Modules
      • Row
      • Column
      • Paragraph
      • Button
      • Image
    • Options
      • Text Input
      • Text Area
      • Select
      • Radio Inputs
      • Checkbox Inputs
      • Date Picker
      • File Upload
      • Dynamic Notice
      • Range Slider
      • Matrix
      • Extra Cart Button
      • Google Map
      • Distance by Postcode
      • Font Preview
    • Fields Conditional Logic
    • Validation Conditional Logic
    • Colorify Feature
    • Imagify Feature
    • "Free Sample" Feature
    • Arithmetic Operators
    • Manage Order Items
    • Suboptions export/import
  • For developers
    • Actions & Filters
    • JS events
    • Extending Uni CPO
  • Duplicating options and products
  • How to debug
  • Affiliation
  • Themes & Plugins Compatibility
    • Popup Maker How To
    • Boxtal
    • Pitchprint.com
    • NBDesigner
    • Toggle Tax For Woocommerce
  • FAQ
  • Refund Policy
  • Managing licenses and billing info
    • License Utilization
  • Uni CPO Add-ons
    • Custom dynamic SKU (paid)
      • Stock management based on dynamic SKU
    • "Send Inquiry" (free)
    • Hidden/disabled option (free)
Powered by GitBook
On this page
  • Adding new options
  • Adding new settings

Was this helpful?

  1. For developers

Extending Uni CPO

It is possible to extend Uni CPO plugin by adding new options and settings. This article includes the related information and guides.

Adding new options

New option must be a class that follow specific naming convention and extends abstract 'Uni_Cpo_Option' class and implements the same interface as other option related classes. The easiest solution would be to make a copy of one of the existing classes and modify it according to your needs.

The naming convention examples:

  • if option type is 'fantasy_option' then its class must be called 'Uni_Cpo_Option_Fantasy_Option'

  • if option type is 'radio_special_links' then its class must be called 'Uni_Cpo_Option_Radio_Special_Links'

Filters

uni_cpo_option_types

This filter accepts one argument - an array of unique option names.

Example of using:

add_filter( 'uni_cpo_option_types', 'my_option_types', 10, 1 )
function my_option_types($types) {
        $types[] = 'fantasy_option';
        return $types;
}

------------------------

uni_cpo_option_classes / uni_cpo_option_classes_pro

This filter accepts one argument - an array of paths to php file with class of the option. The filter prefixed with 'pro' will be used only in PRO version of the plugin.

Example of using:

add_filter( 'uni_cpo_option_classes', 'my_option_classes', 10, 1 )
function my_option_classes($pathes) {
        $pathes[] = $this->plugin_path() . '/inc/class-uni-cpo-option-fantasy-option.php';
        return $pathes;
}

Adding new settings

Similar to new option class name, setting class name follows the same naming convention and extends one of the abstract classes. The easiest way would be to make a copy of existing setting class and then modify it.

Filters

uni_cpo_setting_types

This filter accepts one argument - an array of unique setting names.

Example of using:

add_filter( 'uni_cpo_setting_types', 'my_settings_types', 10, 1 )
function my_settings_types($types) {
        $types[] = 'super_setting';
        return $types;
}

------------------------

uni_cpo_settings_classes / uni_cpo_settings_classes_pro

This filter accepts one argument - an array of paths to php file with class of the setting. The filter prefixed with 'pro' will be used only in PRO version of the plugin.

Example of using:

add_filter( 'uni_cpo_settings_classes', 'my_settings_classes', 10, 1 )
function my_settings_classes($pathes) {
        $pathes[] = $this->plugin_path() . '/inc/class-uni-cpo-setting-super-setting.php';
        return $pathes;
}

PreviousJS eventsNextDuplicating options and products

Last updated 2 years ago

Was this helpful?