📜  不推荐使用:WC_Product::get_dimensions 错误修复 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:53:54.232000             🧑  作者: Mango

代码示例1
add_action( 'woocommerce_single_product_summary', 'baba_spec', 35 );
 
function baba_spec() { 
    global $product;
    $dimensions = wc_format_dimensions($product->get_dimensions(false));
        if ( $product->has_dimensions() ) {
            $label = __( 'Dimensions: ', 'babasouktextdomain' );
            print '' . $label . ''; 
            echo '' . $dimensions . '';
        }
            print '
'; }