• Resolved mesmer7

    (@mesmer7)


    These two commands

    `
    remove_action( ‘woocommerce_after_shop_loop_item_title’, ‘woocommerce_template_loop_price’, 10 );
    add_action( ‘woocommerce_after_shop_loop_item’, ‘woocommerce_template_loop_price’, 5 );`

    are working in my development environment MAMP. And at first they were working on my hosting server (godaddy). But after I activated Autoptimize and Async JavaScript, the remove_action command ceased to work. I deactivated both plugins, but it still refuses to work on the server. I even deleted Async Javascript, but the remove_action command refuses to function.

    The remove_action command continues to work properly in the MAMP environment where I never tried those two plugins. And the add_action continues to work in both environments. But I can’t restore functionality on the hosting server.

    In case you can’t tell: I’m trying to move the price below the excerpt on the shop page’s list view.

    Warning: web site contains sexually-related (NSFW) subject matter: https://www.hypnoticdreams.com/mp3s/

    Can anyone help me restore this function?

    • This topic was modified 6 years, 2 months ago by mesmer7.

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Its possible the remove isn’t working because it has not been added before the point in time at which you are removing it. Maybe plugins are being loaded in a different order between your two sites. Try putting it inside ‘woocommerce_before_single_product’ by which time it will certainly have been added.

    add_action( 'woocommerce_before_single_product', 'my_product_page' );
    function my_product_page() {
      // remove_action
    Thread Starter mesmer7

    (@mesmer7)

    ‘woocommerce_before_single_product’ is on the single product page. This problem is on the shop catalog/archive pages.

    Sorry, but the principle still applies. A remove won’t work if the corresponding add has not yet executed. Try the ‘woocommerce_before_main_content’ hook.

    If necessary, install the hookr plugin to show what hooks are active in the relevant page for your theme.

    Thread Starter mesmer7

    (@mesmer7)

    unfortunately, that tool just confirms that I’m calling the correct hook and function. Doesn’t explain what to do when the remove_action stops working.

    Yes I’m sure you’re calling the correct hook, what I’m saying is the thing to try is to put the remove inside an add that is further up the page.

    If the remove is on its own, it may be executed before the relevant add has executed, and if so, the remove won’t work.

    Plugin Support con

    (@conschneider)

    Engineer

    Hi there,

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘remove_action stopped working’ is closed to new replies.