Support

Account

Forum Replies Created

  • A little update on this.

    I’m writing a plugin that interfaces with WooCommerce. In the plugin I’m using ACF to attach custom repeater fields to a user which is then associated with a product. Anyhow, in the following code, get_students_1 returns the wrong list of students and get_students_2 returns the correct list. The two functions are identical.

    public function woocommerce_display_student_in_cart( $item_data, $cart_item ) 
    	{
    $this->get_students_1();
    $this->get_students_2();
    
    ...
    }
    	private function get_students_1()
    	{
    		print '<BR>---------STUDENTS 1--------<BR>';
    		
    		$user = 'user_'.$this->current_user->ID;
    		
    		
    		if( have_rows('student-list', $user) )
    		{
    			print "user has students<BR>";
    			
    			while( have_rows('student-list',$user ) ): the_row();
    
    				$currentName =  get_sub_field('student_name');
    		
    				print "** student $currentName <BR>";
    
    			endwhile;	
    		} 
    		else 
    		{
    			print "user has no students<BR>";
    		}
    	}
    	
    	private function get_students_2()
    	{
    		print '<BR>---------STUDENTS 2--------<BR>';
    		
    		$user = 'user_'.$this->current_user->ID;
    		
    		if( have_rows('student-list', $user) )
    		{
    			print "user has students<BR>";
    			
    			while( have_rows('student-list',$user ) ): the_row();
    	
    				$currentName =  get_sub_field('student_name');
    		
    				print "** student $currentName<BR>";
    	
    			endwhile;	
    			 
    		}
    		else 
    		{
    			print "user has no students<BR>";
    		}
    	}

    In fact, if I just call $this->get_students_1() twice, the first time the list is wrong and the second time it is correct.

    This is seriously confusing. Any ideas?

  • I’m having the exact same issue. Wondering if anyone came up with a solution.

  • I tried this approach but I wasn’t able to save any rows that were added to the repeater.

  • Unfortunately, this solution does not work for dates before 1000. Even if you manually enter a date such as 01/01/0050 (50 AD), it will not save. The resulting behavior is unpredictable, sometimes the field resets to NULL, other times a different date is chosen.

  • I could also use this functionality.

    I’ve been consdiering a hack using jQuery: create separate address fields (address, zip, city, etc), concatenate and copy them into the google map field before publishing.

    It’s important to have the address fields separated out so they can be queried upon.

    DC

Viewing 6 posts - 1 through 6 (of 6 total)