删除添加到购物车通知并更改“添加到购物车"Woocommerce 中的按钮 [英] Remove add to cart notice and change "add to cart" button in Woocommerce
问题描述
如何从购物车页面中删除已添加到您的购物车"文本 以及如何替换数量并使用自定义按钮(我的图像)添加到购物车按钮,使其看起来像这样
How to remove "has been added to your cart" text from shopping cart page and how to replace quantity and add to cart button with custom button ( my image ) for it to look like this
这是现在的样子:.
我使用了 Loic 的 css 代码在我的孩子 style.css 中删除购物车页面中的文本,但它不起作用...
I used Loic's css code in my child style.css to remove text in cart page but it didn't work...
这是我的子 style.css 文件中的完整代码(我是否遗漏了什么):
This is entire code in my child style.css file (Am I missing something):
.woocommerce-checkout .woocommerce .woocommerce-message {
display:none !important;}
推荐答案
有多种方式:
1) 使用 PHP (最好的方法):
add_filter( 'wc_add_to_cart_message_html', '__return_false' );
代码位于活动子主题(或活动主题)的 function.php 文件中.
Code goes in function.php file of your active child theme (or active theme).
2) 使用 CSS (不推荐:因为它在购物车页面上,它会隐藏所有其他通知):
2) Using CSS (not recommended: As it's on cart page, it will hide all other notices):
.woocommerce-cart .woocommerce .woocommerce-message {
display:none !important;
}
进入您的活动子主题(或活动主题)的 style.css 文件.
Goes in styles.css file of your active child theme (or active theme).
要更改添加到购物车按钮的样式,请尝试以下 CSS 规则:
To change add to cart button styling try this CSS rules:
.button.alt.single_add_to_cart_button {
background-color: #36ae33 !important;
color: #ffffff !important;
}
进入您的活动子主题(或活动主题)的 style.css 文件.
Goes in styles.css file of your active child theme (or active theme).
您将不得不添加一些其他规则来更改,字体属性和填充...
You will have to add some other rules to change, font attributes and padding…
这篇关于删除添加到购物车通知并更改“添加到购物车"Woocommerce 中的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!