I want to be able to change a widget which come with my theme on wordpress. The widget is a mini-cart widget in the top right hand corner of a website I am currently working on.

The widget's functionality within js/scripts.js is:

$.fn.rtframework_cart_menu_button=function(){$(this).on("click",function(a){a.preventDefault(),$(".side-panel-contents > *:not(.widget.woocommerce)").removeClass("animate"),$(".side-panel-contents > .widget.woocommerce").addClass("animate"),$("body").hasClass("side-panel-on")||$(window).trigger("rt_side_panel")})},$(".businesslounge-cart-menu-button").rtframework_cart_menu_button()

The function that I want it to provide is simply this:


When I put the function that I want into the console in the inspect tool it does exactly what I want, it opens up the plugins mini-cart from the right hand side exactly as it should.

I have tried the following:


I have tried various ways of adding it in and watched many tutorials but unfortunately I am seriously struggling to understand it. If I had to do it very frequently I would seriously take the time out to learn it but currently I just need it to provide this one simple function instead of the one it provides currently.

If it isn't possible to replace the function of the existing widget on the website then I will try again to create a new widget. Really hope someone can help me as I have been bashing my head at this for hours now and keep going in circles!

0 Answers