📌  相关文章
📜  woocommerce 在产品页面上显示运费 - 无论代码示例

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

代码示例1
add_action('woocommerce_single_product_summary', 'display_specific_shipping_class', 15 );
function display_specific_shipping_class(){
    global $product;

    // HERE define your targeted shipping class name
    $defined_shipping_class = "Estimated Delivery in 7-15 days";

    $product_shipping_class = $product->get_shipping_class();

    // Get the product shipping class term name
    $term_name = get_term_by( 'slug', $product_shipping_class, 'product_shipping_class' );

    if( $term_name == $defined_shipping_class ){
        echo '

' . $term_name . '

'; } }