Change the text of 'View cart' button

Multi tool use
Multi tool use


Change the text of 'View cart' button



Iam using a woocommerce plugin but I got an problem on how to change the text of the view cart button hope there is a one who can help with my problem this is my site
this is the image of the text that i want to change the image how can i edit it? all suggestion are appreciated.




4 Answers
4



Add the following to your functions.php file.


/**
* Change text strings
*
* @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext
*/
function my_text_strings( $translated_text, $text, $domain ) {
switch ( strtolower( $translated_text ) ) {
case 'View Cart' :
$translated_text = __( 'View Shopping Cart', 'woocommerce' );
break;
}
return $translated_text;
}
add_filter( 'gettext', 'my_text_strings', 20, 3 );



This will change View Cart to View Shopping Cart





That's so useful to me, you can't even imagine how much... thanks!!!
– Avni Yayin
Apr 20 '17 at 4:31





remove strtolower from the switch, and it works.
– Wesam Alalem
Sep 10 '17 at 11:06



Add the following code to your functions.php file


function change_view_cart_link( $params, $handle )
{
switch ($handle) {
case 'wc-add-to-cart':
$params['i18n_view_cart'] = "Proceed to Cart"; //chnage Name of view cart button
$params['cart_url'] = "http://myshop.com/custom-page"; //change URL of view cart button
break;
}
return $params;
}



you just need to add the below hook filter to change the add to cart text:


woocommerce_product_single_add_to_cart_text



For more specifically check below reference link:



Change add to cart text - therichpost



Go to wp-contentpluginswoocommerceincludeswc-template-functions.php
then edit raw 1429


wp-contentpluginswoocommerceincludeswc-template-functions.php


function woocommerce_widget_shopping_cart_button_view_cart() {
echo '<a href="' . esc_url( wc_get_cart_url() ) . '" class="button wc-forward">' . esc_html__( 'View cart', 'woocommerce' ) . '</a>';
}
}
function woocommerce_widget_shopping_cart_button_view_cart() {
echo '<a href="' . esc_url( wc_get_cart_url() ) . '" class="button wc-forward">' . esc_html__( 'your text', 'woocommerce' ) . '</a>';
}
}



version woocommerce 3.0.3.


woocommerce 3.0.3





Do not EVER edit core plugin files...
– Mat
Nov 1 '17 at 14:06






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

QT,xjNpmMNjL5ulT4oF,xzVmufB3fWi,fGErj0FD0deT,cxNHfrFqXcTcw6tZuwAX679OdstiK708RP
ho,t,GJc r36mDdOhtz3YeIUDXfplqEH

Popular posts from this blog

PySpark - SparkContext: Error initializing SparkContext File does not exist

django NoReverseMatch Exception

List of Kim Possible characters