Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing quantity label in woocommerce cart page

How can i change the quantity label appear in table header in woocommerce cart page ? I need to change the header label of quantity to something else.

like image 924
Pus Avatar asked Feb 10 '23 15:02

Pus


1 Answers

You need to edit the template file for the cart page.

Does your theme already have a /woocommerce/ folder with each template? If not you should copy the /cart/ folder from /wp-content/plugins/woocommerce/templates/ to /your-theme/woocommerce/ then edit /cart/cart.php and search for "Quantity".

You could also use this trick in your functions.php file to replace everything that says "Quantity" on your site:

add_filter('gettext', 'translate_reply');
add_filter('ngettext', 'translate_reply');

function translate_reply($translated) {
$translated = str_ireplace('Quantity', 'New Label', $translated);
return $translated;
}

Just change "New Label" to whatever you want to call it.

like image 160
Tom Green Avatar answered Feb 15 '23 12:02

Tom Green