• adukale

    (@adukale)


    Hello

    I have removed certain action using remove_action() but what if i want add that particular action using add_action() at runtime?

    Example:

    I removed woocommerce price section using remove_action() but when i click add to cart or a custom button i want to execute add_action().

    Thank You

Viewing 3 replies - 1 through 3 (of 3 total)
  • Bob Cristello

    (@gntmidnight)

    Bob Cristello

    (@gntmidnight)

    For example, this is from the functions.php in my theme where I added an action when the theme is switched. The add_action function builds a hook between the ACTION (in this case switch_theme) and the function. That is all there is to it.

    // Framework Deactivation
    function cmsms_theme_deactivation() {
    	delete_option('cmsms_active_theme');
    }
    
    add_action('switch_theme', 'cmsms_theme_deactivation');
    Thread Starter adukale

    (@adukale)

    Hello
    Thank you for reply.
    Actually i wang to do this

    I removed product meta and other details of products from products page in woocommerce.
    Now when i click on add to cart or any ther button i put on product page, i want to execute add_action() function of woocommerce which will display producf description.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to use add_action and/or remove_action at runtime’ is closed to new replies.