问题
I am using the following code to replaced the quantity column in cart with persons for bookable products (i am using WooCommerce Bookings plugin). However, it only changes the cart Qty in the front end but other actions like shipping costs / cart fees set based on qty in cart is not getting updated. Can i add some more code to the above to even replace the qty with persons at the backend for other operations like shipping cost and cart fees.
function replace_cart_quantity_for_bookings( $quantity, $cart_item_key, $cart_item ){
// Only for bookable product items
if( isset($cart_item['booking']) && isset($cart_item['booking']['_qty']) ){
$quantity = '<span style="text-align:center; display:inline-block; line-height:10px">'.$cart_item['booking']['_qty'].'<br>
<small>(' . __('persons','woocommerce') . ')</small><span>';
}
return $quantity;
}
来源:https://stackoverflow.com/questions/61852727/replace-qty-in-cart-for-bookable-product-at-the-backend-with-persons-for-all-sub