Plugin API, Filters, Actions

This section is constantly updated as new features, functions, filters and actions are included in the plugin core. If you have question which this page does not cover up, contact us for support.

The information on this page is currently meant for developers and advanced users only. The regular user do not need to use this info.


Table of Contents

  1. Action – woo_mstore/options/options_output
  2. Filter – woo_mstore/options/options_save
  3. Filter – woonet/admin_product/filter_product_meta/product_meta
  4. Filter – woo_mstore/save_meta_to_post/ignore_meta_fields

1) Action woo_mstore/options/options_output – top

Arguments: none
Description: This hock can be used to add additional options within main plugin settings area.
Example of usage:

add_action('woo_mstore/options/options_output', 'my_woo_mstore_options_html');
    function my_woo_mstore_options_html()
        {
             
            ?>
            <select name="my_custom_option">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
            </select>
            <?php
                
        }

2) Filter – woo_mstore/options/options_save – top

Arguments: $options
Return: $options
Description: This hock can be used to save customized options inserted through woo_mstore/options/options_output within plugin main settings page
Example of usage:

add_filter('woo_mstore/options/options_save', 'my_woo_mstore_options_save');
    function my_woo_mstore_options_save($options)
        {
             
            //add our data
            $options['my_option']  =   isset($_POST['my_option']) ?     $_POST['my_option'] :  '';
             
            return $options;
                
        }

3) Filter – woonet/admin_product/filter_product_meta/product_meta – top

Arguments: $product_meta
Return: $product_meta
Description: Filter out specific meta data from product meta list
Example of usage:

add_filter('woonet/admin_product/filter_product_meta/product_meta', 'my_woonet_admin_product_filter_product_meta_product_meta');
    function my_woonet_admin_product_filter_product_meta_product_meta($product_meta)
        {
            if(isset($product_meta['unwanted_field']))
              unset($product_meta['unwanted_field']);
             
            return $product_meta;
                
        }

4) Filter – woo_mstore/save_meta_to_post/ignore_meta_fields – top

Arguments: $ignore_meta_fields, $post_ID, $blog_id
Return: $ignore_meta_fields
Description: Add to ignore list meta fields which does not intend to be replicated to other products in the network
Example of usage:

add_filter('woo_mstore/save_meta_to_post/ignore_meta_fields', 'my_woonet_save_meta_to_post_ignore_meta_fields');
    function my_woonet_save_meta_to_post_ignore_meta_fields($ignore_meta_fields, $post_ID, $blog_id)
        {
            
            //check agains the required $blog id
            if($blog_id !=  1)
                return $ignore_meta_fields;
                
            //check against a specific product id
            
            if ($post_ID != 100)
                return $ignore_meta_fields;   
            
            $ignore_meta_fields[]   =   'unwanted_field';
             
            return $ignore_meta_fields;
                
        }

Go To Table of Contents