【问题标题】:Woocommerce add to cart button styleWoocommerce 添加到购物车按钮样式
【发布时间】:2015-03-18 13:04:31
【问题描述】:

我在我的网站上使用 woocommerce (http://masterscoffeeandwater.com/bottled-water/),我想在我的网站上设置“添加到购物车”按钮的样式,目前它显示为非常无聊的文本链接..

我正在使用下面的 CSS 但它不起作用

.single_add_to_cart_button:hover {
    background: green !important;
}
.single_add_to_cart_button {
    background: red !important;
}

任何帮助将不胜感激

我被困在这里

【问题讨论】:

    标签: css wordpress woocommerce


    【解决方案1】:

    将您的课程“single_add_to_cart_button”添加到 add-to-cart.php (wp-content/themes/YOUR THEME/woocommerce/loop/add-to-cart.php)

    你会在那里找到“锚”标签。只需在其中添加类。

    【讨论】:

    • 我添加了但它不起作用:( echo apply_filters( 'woocommerce_loop_add_to_cart_link', sprintf( '<a class="single_add_to_cart_button" href="%s" rel="nofollow" data-product_id="%s" data-product_sku="%s" data-quantity="%s" class="button %s product_type_%s">%s</a>',
    • 您将在 add-to-cart.php (wp-content/themes/YOUR THEME/woocommerce/loop/add-to-cart.php) $product->is_purchasable() 中找到以下行&& $product->is_in_stock() ? '您的班级名称' : '', ......它会起作用的。
    • 我试过了,它不起作用,而且这条路径是否正确 wp-content/themes/YOUR THEME/woocommerce/loop/add-to-cart.php,我认为 add_to_cart 不在插件文件夹中在主题中
    • 如果您想要为您的主题定制 woocommerce 模板,它也在您的主题文件夹中。将 add-to-cart.php 的代码发送给我。
    • 我在主题文件夹 Hardik 中没有,我只有在插件文件夹中有 add_to_cart,这是链接 [link] (filedropper.com/add-to-cart)
    猜你喜欢
    • 2018-10-30
    • 1970-01-01
    • 1970-01-01
    • 2012-08-30
    • 1970-01-01
    • 1970-01-01
    • 2017-09-08
    • 2018-05-08
    相关资源
    最近更新 更多