Support » Plugin: WooCommerce » Since WooCommerce Update, One Hook causes multiple issues

  • Resolved simon_a6


    add_action( ‘woocommerce_after_add_to_cart_button’, ‘content_after_addtocart_button’ );
    function content_after_addtocart_button() {

    Today we updated Woocommerce and since then, the product pages are showing the results of our hook, twice.

    When we run it, it renders the text twice, with this split between each rendering:

    <input type=”hidden” name=”add-to-cart” value=”794″ />
    <input type=”hidden” name=”product_id” value=”794″ />
    <input type=”hidden” name=”variation_id” class=”variation_id” value=”0″ />

    Has the latest WC update changed the product page, causing this, as I don’t see anything else to be a cause, as we use this hook elsewhere without a problem.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Con Schneider


    Automattic Happiness Engineer

    Hi there,

    That is probably a conflict between active components. Here is a screen shot of a quick cross test:

    Using the hook with the test function is straight forward and should not duplicate the output. I suggest a conflict check:

    You can use for this. It allows you to deactivate all plugins and activate a default theme just for your user session. 

    Everyone else will see your site normally. 
    Activate the plugin and enter the “troubleshooting mode”: /wp-admin/index.php?page=health-check&tab=troubleshoot. You can then do a test again. Troubleshooting mode also allows you to selectively toggle plugins back on. 

    The plugin requires a default theme like Twenty Seventeen present to work fully. 

    **Before you do that, please do make a full backup!**

    We found a better function, one that adds after the whole form, rather than just the button. The issue was only on Variables.

    Excellent question! Sorry for hijacking this topic, but I have the exactly same problem I can see that it hasn’t been really closed. I’ve digged the entire web in search for a solution in the past 3 days and I haven’t found one yet.
    Everything is updated at latest version (Woo 3.4.3, WP 4.9.7, Apache/2.4.17, PHP/5.6.20, mySQL 5.5.5-10.1.13-MariaDB, XAMPP enviroment, no template overrides in Woo.

    I have 3 fields that are showing twice (duplicated). The problem appears only on variables product page. On single product pages it’s all good.
    I have also a plugin called WC Fields Factory 2.0.8 which is also rendering two custom defined fields twice (just on variables product page too).

    An example of a function I use is below:

    //Add USP under the SINGLE PRODUCT ADD TO CART button
    function add_usp_after_add_to_cart() {
    	// Echo content.
       echo '<div class="add-to-cart-usp">
    add_action('woocommerce_after_add_to_cart_button', 'add_usp_after_add_to_cart', 10);

    Tried everything until now. Any ideas?


    Just wanted to let you all know this is a conflict with the WC Variations Radio Buttons plugin. When activated, the fields duplicate on variations product page.
    I’ve Deactiveted it and it’s all good again.

    Sorry for the trouble.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Since WooCommerce Update, One Hook causes multiple issues’ is closed to new replies.