1

See I have a problem / I now want to display a custom field in a place where this field has several options that I tick if I see it in the product tab. If I do not show, do not display the following codes. Thank you.

  1. The code below shows the field:

    $badges = get_field('badges_product'); 
    if( $badges && in_array('licensed', $badges) ): 
        ?>
        <p>Test</p>
    <?php endif; ?>
    
  2. But despite this code does not display:

    get_field('badges_product');
    
  3. If I put this code instead of the code above:

    global $product;
    $units_sold = get_post_meta( $product->id, 'badges_product', true );
    echo ''. sprintf( __( '%s', 'woocommerce' ), $units_sold ).'';
    

Now I'm going to put the third code in place of the second code, but I can not do anyone can help me out? Thanks

New contributor
M z3ndani is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • Your question is totally unclear and not understandable… could you please reword it. If you are using Advanced custom fields plugin, you should mention that in your question. – LoicTheAztec May 15 at 20:01

Your Answer

M z3ndani is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.