Support

Account

Forum Replies Created

  • I got it working using the Wysiwyg Editor to upload the image instead. Thanks for your help.

    The final code is

    add_action('woocommerce_single_product_summary','finish_image',22);
    
    function finish_image() {
    
    $terms = get_the_terms( $post->ID , 'pa_metal-finish' );
    if($terms) {
       foreach( $terms as $term ) {
    
      echo '<b>Finish: </b>'. get_field('finish_img', 'pa_metal-finish'.'_'.$term->term_id);
    
    }
    }
    }
    

    With use of the Wysiwyg Editor for image upload

  • Sorry I just realized I should have added it as a code

    add_action('woocommerce_single_product_summary',"finish_image",22);
    
    function finish_image() {
    
    $terms = get_the_terms( $post->ID , 'pa_metal-finish' );
    if($terms) {
       foreach( $terms as $term ) {
    
      echo '<b>Finish:</b>'. '<img src= '<?php get_field('finish_img', 'pa_metal-finish'. '_' .$term->term_id);' ?>' />'
    }
    }
    }
    	
    	
  • I am so close, keep coming up with a parce error. What am I doing wrong here? I know it has something to do with the IMG SRC and quotes

    add_action(‘woocommerce_single_product_summary’,”finish_image”,22);

    function finish_image() {

    $terms = get_the_terms( $post->ID , ‘pa_metal-finish’ );
    if($terms) {
    foreach( $terms as $term ) {

    echo ‘<b>Finish:</b>’. ‘term_id);’ ?>’ />’
    }
    }
    }

  • Making progress I know have the code working, only shows url still though. need to look though the document above

    add_action(‘woocommerce_single_product_summary’,”finish_image”,22);

    function finish_image() {

    $terms = get_the_terms( $post->ID , ‘pa_metal-finish’ );
    if($terms) {
    foreach( $terms as $term ) {

    echo ‘<b>Finish:</b>’. get_field(‘finish_img’, ‘pa_metal-finish’. ‘_’ .$term->term_id);
    }
    }
    }

    I am close though

  • I have gotten the image url to show back up if I give the full path to a single Attribute.

    add_action(‘woocommerce_single_product_summary’,”finish_image”,22);

    function finish_image() {
    echo ‘<b>Finish:</b>’. get_field(‘finish_img’, ‘pa_metal-finish_79’);
    }

    But I need the code to search though the metal finish attributes to find the one that applies to that Item.

    I know its something like the post found here.

    https://support.advancedcustomfields.com/forums/topic/get-field-from-woocommerce-attribute-taxonomy/

    but I cant seem to quite figure it out, do you have any insite?

  • The thing is even if I change it to a text box, not data can been seen now. Not sure what I did, but I think I broke ACF…. I can tell that its going to go to the right place because I can see the word Finish: from the echo. Does my code look right to you?

  • Well I have done some research and have almost got the code working. Currently the code looks like this

    add_action(‘woocommerce_single_product_summary’,”finish_image”,22);

    function finish_image() {
    echo ‘<b>Finish:</b>’ .get_field(‘finish_img’, $product_id);
    }

    For some reason the image will not show, It just shows the text “array”(not the setting the actual word array). If I change it to URL, It shows the right url and if I change it to Image ID it show the right id.

    After playing with the settings more, I can no longer get anything to come up, please help!

    Thanks

    Jake

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