Display custom field without plugin in woocommerce

by M z3ndani   Last Updated May 15, 2019 15:08 PM

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) ): 
    <?php endif; ?>
  2. But despite this code does not display:

  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.

Tags : woocommerce

Related Questions

Updated March 26, 2015 12:02 PM

Updated March 27, 2015 05:02 AM

Updated April 04, 2015 15:03 PM

Updated April 04, 2015 16:03 PM

Updated April 06, 2015 19:03 PM