私はプラグインを作成し、woocomerceからブランド名を取得します。 最初に製品No.1のプラグインを作って、私が望むようにプロダクトブランドを手に入れます。ブランド名からプロダクトポストNo.2とNo.3を作成すると、製品番号1PHP Woocomerce製品名を取得
whats wrong?
if (class_exists('WooCommerce')) {
$kode = $product->get_sku();
$terms = wp_get_post_terms($product_id, 'brand', array('orderby'=>'name'));
$brands = get_terms('brand', array(
'orderby' => 'name'
//,'product__in' => $product->id
// orderby arguments ('name', 'slug','term_group', 'term_id', 'id', 'description')
));
foreach ($brands as $key => $brand) :
$brand_name = $brand->name;
endforeach;
$merk = $brand_name;
//this i want to print the brand name
echo "<strong>STOCK ".$merk." ".$kode."</strong><br/>";
} else {
echo "please active your WooCommerce plugin.";
}
お願いします。
私たちはあなたが何をしているのかを見ることができます。 '$ brand_name'は' brands'の最後の値に設定されます。 – GeorgeQ
私はコードを編集しています。 –