Support » Plugin: WC Fields Factory » Showing custom field twice

  • Hello,

    The plug in was working well on the site but recently it has resulted in the custom field being show twice on every page it is intended for. In the settings there is only one field and not set to the same page twice.

    Can someone please advise.



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

Viewing 15 replies - 16 through 30 (of 36 total)
  • When was this update? I have still two fields LOL

    Hi guys,

    After updating Woocommerce and this plugin to the latest version, try checking the overridden template ‘single-product/add-to-cart/variable.php’. In my case, I had to update this template to remove (or comment) calling of these actions:

    do_action( 'woocommerce_before_add_to_cart_button' );


    do_action( 'woocommerce_after_add_to_cart_button' );

    It appears that Woocommerce now adds those calls someplace else already, probably when rendering the actual cart button as part of action woocommerce_single_variation

    +1 on this issue, running latest versions of everything, with no template overrides in place. Curiously it’s only doing it on one product.

    hi! i am having this exact problem right now since last wordpress update. can anyone help me? how do i fix it?


    Same problem here. 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, WC Fields Factory 2.0.8, no template overrides in Woo.
    Tried everything. Any ideas?

    Thank you,

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

    Sorry for the trouble.

    I am also experiencing this issue. I don’t want to go down the jQuery hack route. Is there going to be an official fix to this issue please?

    Hi there!

    @pixvault suggested code was working fine, but now my Upsell products under sigle product page is gone?

    I guess it’s because of changed variable.php and variation-add-to-cart-button.php files?

    Can anyone please help me find the fix for this?

    How to get back linked upsell products?

    Thanks in advance.


    i used ccs code that works fine. i fount it in one of the forums

    .variations_form.cart > .wccpf-fields-group-1 {display: none}

    Hi there -I was able to track down the issue, at least from what I was experiencing. I noticed that the fields were not duplicating on every product (I have multiple groups of fields linked to different products).

    I was only experiencing this on VARIABLE SUBSCRIPTIONS, so I took a look at the template (/plugins/woocommerce-subscriptions/templates/add-to-cart-/variable-subscription.php) and saw that it calls do_action(‘woocommerce_before_add_to_cart_button’); before it calls do_action( ‘woocommerce_single_variation’ );

    So I took a look at the variation add to cart template and that ALSO calls do_action(‘woocommerce_before_add_to_cart_button’);

    THIS IS WHY IT DUPLICATES – so I have made custom templates in my theme directory for the subscription, removing the extra calls and lodging a ticket with the plugin author.

    This may or may not be your issue, but track down the templates/woo structures in use and see if a call is being fired multiple times.

    SIMPLY HIDING VIA CSS WILL NOT WORK IF YOU HAVE REQUIRED FIELDS, so take a look and see where it is failing for you.

    Thank you Xitadel! Frustratingly I hadn’t realised (what is now obvious) that WooCommerce Subscriptions has its own templates. Applying your fix has done it for me! Glad not to be relying on JS / CSS fixes.

    Plugin Author sarkparanjothi


    Please update wcfields factory 3.0.0
    Still having same issue let me know

    Last night auto update broke the wordpress website.. trying to figure out how to fix this issue after the update. Anyone knows?

    Fatal error: Can’t use function return value in write context in /home4/domain/wp-content/plugins/wc-fields-factory/includes/wcff-dao.php on line 563

    Plugin Author sarkparanjothi



    Please update your server php version or replace that entire method like

    public function update_field($_pid = 0, $_payload) {
    	    $_pid = absint( $_pid );
    	    $res  = true;
    	    $msg = "";
    	    $field_meta_key = "";
    	    $field_unopen = isset( $_payload["wcff_unopen_details"] ) ? $_payload["wcff_unopen_details"] : array();
    	    $_payload = isset( $_payload["wcff_field_metas"] ) ? $_payload["wcff_field_metas"] : array();
    	    for( $i = 0; $i < count( $_payload ); $i++ ){
    	        $payload = $_payload[$i];
    	        if ( isset( $payload[ "key" ] ) && $payload[ "key" ] != "" ) {
    	            $field_meta_key = $payload[ "key" ];
    	        } else {
    	            $field_meta_key = "";
        		if( $res ){
        		    $check_not_empty = !empty( $field_meta_key ) && !empty( get_post_meta( $_pid, $field_meta_key, true ) );
        		    if( $check_not_empty ){
        		        $payload = apply_filters( 'wcff_before_update_field', $_payload[$i], $_pid );
        		        delete_post_meta( $_pid, $field_meta_key );
        		        if( add_post_meta( $_pid,  $field_meta_key, wp_slash( json_encode( $payload ) ) ) == false ) {
        		            $res = false;
        		            $msg = "Failed to update the custom field";
            		} else {
            		    $res = $this->save_field( $_pid, $_payload[$i] );
            		    if( !$res ){
            		        $msg = "Failed to create custom field";
    	    foreach( $field_unopen as $key => $data ){
    	       $field_meta = get_post_meta( $_pid,  $key, true );
    	       $check_empty = !empty( $field_meta );
    	       if( $check_empty ){
    	           $field_meta_json = json_decode( $field_meta, true );
    	           foreach( $data as $meta_key => $meta_val ){
    	               $field_meta_json[$meta_key] = $meta_val;
    	           delete_post_meta( $_pid, $key );
    	           if( add_post_meta( $_pid,  $key, wp_slash( json_encode( $field_meta_json ) ) ) == false ) {
    	               $res = false;
    	               $msg = "Failed to update the custom field";
    	    return array( "res" => $res, "msg" => $msg );
Viewing 15 replies - 16 through 30 (of 36 total)
  • The topic ‘Showing custom field twice’ is closed to new replies.