how to get product attributes from wordpress database

后端 未结 3 1251
走了就别回头了
走了就别回头了 2020-12-29 16:29

Writing custom code to create product detail page with wordpress database.

I have displayed product title, desc, price, stock, etc and got stuck up with product attr

3条回答
  •  一生所求
    2020-12-29 16:34

    $args = array( 'post_type' => 'product','' ); $products = get_posts( $args );

         foreach ($products as $product) {
            $data = get_post_meta($product->ID);            
            $pr['regular_price'] = $data['_regular_price']['0'];
            $pr['sale_price'] = $data['_sale_price']['0'];
    

提交回复
热议问题