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.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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
回答2:
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;
}
回答3:
Go to wp-content\plugins\woocommerce\includes\wc-template-functions.php
then edit raw 1429
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
.