-1

Currently, this code returns "Quantity x Price"... so e.g. 2 x £3.00

<?php echo apply_filters( 'woocommerce_widget_cart_item_quantity', '<span class="quantity">' . sprintf( '%s &times; %s', $cart_item['quantity'], $product_price ) . '</span>', $cart_item, $cart_item_key ); ?>

But I want it to return either "Quantity x the word Quote"... so e.g. 2 x Quote.

Or... "Quantity: 2"

Could you advise how I should alter this code to achieve either of these two outcomes?

Many thanks,

Richard

0

You can use the following function and filter hook

function filter_woo_cart_quantity($output, $cart_item, $cart_item_key){
        return '<span class="quantity">' . sprintf( '%s &times; Quote', $cart_item['quantity'] ) . '</span>';
    }
add_filter('woocommerce_widget_cart_item_quantity','filter_woo_cart_quantity',10, 3);
  • Thanks for the reply. That doesn't seem to work. It just returns "1" and nothing else. – EILrichard Jun 30 '15 at 10:58
  • I updated the code. Check now. If it doesn't work try changing the number 10 to a bigger value than 10 – Karun Jun 30 '15 at 11:01
  • I appreciate the help Karun, but it's not working. It just returns a 1 no matter what number I replace 10 with. – EILrichard Jun 30 '15 at 12:47
  • What about option 2... i.e. just returning Quantity = 2 (or whatever number of that product you have in your cart). – EILrichard Jun 30 '15 at 12:48
  • The method is same. The function should have worked. – Karun Jun 30 '15 at 12:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.