Title: JavaScript hooks on plugin
Last modified: January 4, 2021

---

# JavaScript hooks on plugin

 *  [Harry](https://wordpress.org/support/users/perfeshnal/)
 * (@perfeshnal)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/javascript-hooks-on-plugin/)
 * Hello,
    Thanks for nice plugin can you please help me to use javascript hook 
   [https://docs.berocket.com/plugin/woocommerce-ajax-products-filter#javascript-2](https://docs.berocket.com/plugin/woocommerce-ajax-products-filter#javascript-2)
   I don’t know where I should put this code
 *     ```
       bapf_custom_smb_open_function = function(use_default, $this) {
           $this.find('.bapf_body').first().show();
           if( $this.find('.bapf_colaps_smb').length ) {
               $this.find('.bapf_colaps_smb').removeClass('fa-chevron-down').addClass('fa-chevron-up');
           }
           return false;
       }
       if ( typeof(berocket_add_filter) == 'function' ) {
           berocket_add_filter('colaps_smb_open_apply', bapf_custom_smb_open_function);
       } else {
           jQuery(document).on('berocket_hooks_ready', function() {
               berocket_add_filter('colaps_smb_open_apply', bapf_custom_smb_open_function);
           });
       }
       ```
   

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Author [RazyRx](https://wordpress.org/support/users/razyrx/)
 * (@razyrx)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/javascript-hooks-on-plugin/#post-13871583)
 * Hello,
 * It is JavaScript code and you need to add it to some JavaScript file that will
   be loaded on the page or add it inline on the page.
 * Regards,
    Oleg
 *  Thread Starter [Harry](https://wordpress.org/support/users/perfeshnal/)
 * (@perfeshnal)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/javascript-hooks-on-plugin/#post-13872097)
 * thanks for your response
    before I make this topic I added this code on a js 
   file and also inline but I don’t know why is not working and not effect on page.
   I see code also when check source on browser. please show me right way to add
   this code on my functions.php and you sure is works
 *  Thread Starter [Harry](https://wordpress.org/support/users/perfeshnal/)
 * (@perfeshnal)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/javascript-hooks-on-plugin/#post-13885718)
 * I’m waiting for your answer
 *  Plugin Author [RazyRx](https://wordpress.org/support/users/razyrx/)
 * (@razyrx)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/javascript-hooks-on-plugin/#post-13895581)
 * Hello,
 * Code example provided in documentation doing same thing as default code in plugin.
 * Regards,
    Oleg
 *  Thread Starter [Harry](https://wordpress.org/support/users/perfeshnal/)
 * (@perfeshnal)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/javascript-hooks-on-plugin/#post-13897310)
 * **unfortunately your response not helping me my friend!**
    I read plugin document
   before then came here and open a topic is not so hard for you if your JavaScript
   hook working perfectly tell me how I use it in my functions.php with a sample
 *  Plugin Author [Dmytro Holovnia](https://wordpress.org/support/users/dholovnia/)
 * (@dholovnia)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/javascript-hooks-on-plugin/#post-13898014)
 * Hi,
 * Please try to read provided answer more attentively.
 * “Code example provided in documentation doing same thing as default code in plugin”.
   It means that adding this code will not change anything. You need to edit it 
   somehow to see the difference. Did you change anything in the code example? `
   fa-chevron-down` or `fa-chevron-up` to something else? Or add some class that
   will make color red?
 * Regards,
    Dima

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘JavaScript hooks on plugin’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce-ajax-filters/assets/icon-256x256.gif?rev=2770304)
 * [Advanced AJAX Product Filters](https://wordpress.org/plugins/woocommerce-ajax-filters/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce-ajax-filters/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce-ajax-filters/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce-ajax-filters/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce-ajax-filters/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce-ajax-filters/reviews/)

 * 6 replies
 * 3 participants
 * Last reply from: [Dmytro Holovnia](https://wordpress.org/support/users/dholovnia/)
 * Last activity: [5 years, 4 months ago](https://wordpress.org/support/topic/javascript-hooks-on-plugin/#post-13898014)
 * Status: not resolved