Php WooCommerce-每个产品而不是每个购物车的展示费

Php WooCommerce-每个产品而不是每个购物车的展示费,php,wordpress,woocommerce,Php,Wordpress,Woocommerce,我必须在WooCommerce商店的每行购物车上加一笔费用。此费用旨在改变单价和行金额。 此费用不作为运费和总价。 每篮线/每件产品需支付服务费(54美元) 例如,每件产品$0.81加上$54的服务费,每件产品$1.81,50件总共$94.66 到目前为止我所拥有的 // Change the line total price add_filter( 'woocommerce_get_discounted_price', 'calculate_discounted_price', 10, 2 )

我必须在WooCommerce商店的每行购物车上加一笔费用。此费用旨在改变单价和行金额。 此费用不作为运费和总价。 每篮线/每件产品需支付服务费(54美元)

例如,每件产品$0.81加上$54的服务费,每件产品$1.81,50件总共$94.66

到目前为止我所拥有的

// Change the line total price
add_filter( 'woocommerce_get_discounted_price', 'calculate_discounted_price', 10, 2 );
// Display the line total price
add_filter( 'woocommerce_cart_item_subtotal', 'display_discounted_price', 10, 2 );

function calculate_discounted_price( $price, $values ) {
    $price += 5;
    return $price;
}
function display_discounted_price( $values, $item ) {
    return wc_price( $item[ 'line_total' ] );
}
非常感谢你的帮助