最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Display custom field without plugin in woocommerce

programmeradmin0浏览0评论

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

发布评论

评论列表(0)

  1. 暂无评论