Suggested fix displaying product quantities
-
In the Checkout page (and other places), the items in the cart are listed in the form: “Description x quantity”, such as “Thingie x 3”. In borderline situations with long descriptions, line breaks can give misleading displays like:
Thingie x 3In some contexts the “x” would be a control to delete that item, but not here.
My fix is to make the space between the “x” and the number a non breaking space.
A filter like this does it:add_filter('woocommerce_order_item_quantity_html', 'abc_qty_fixup'); add_filter('woocommerce_checkout_cart_item_quantity', 'abc_qty_fixup'); function abc_qty_fixup($str) { return str_replace("× ","× ",$str); }However I feel that the correct fix is to change the strings in the core plugin files, which include:
woocommerce/templates/order/order-details-item.php: woocommerce/templates/checkout/form-pay.php: woocommerce/templates/checkout/review-order.php:I notice that “esc_html(” is only used on the quantity field in one of these three places, presumably there is a reason for this.
The topic ‘Suggested fix displaying product quantities’ is closed to new replies.