如何在WooCommerce中添加更多按钮添加到购物车通知?

时间:2017-05-07 00:02:46

标签: css button woocommerce notice

我想对我的网站进行此更改。 enter image description here

在购物车中添加产品后,我想在图片中显示的通知中集成更多按钮。我想在里面放置按钮:

  • 继续购物并完成购物按钮。

怎么做?我在谷歌搜索并找到了一些功能,但没有一个能满足我的需求。这是其中之一:

/**
 * Custom Add To Cart Messages
 * Add this to your theme functions.php file
  **/
add_filter( 'wc_add_to_cart_message', 'custom_add_to_cart_message' );
function custom_add_to_cart_message() {
global $woocommerce;
// Output success messages
if (get_option('woocommerce_cart_redirect_after_add')=='yes') :
    $return_to  = get_permalink(woocommerce_get_page_id('shop'));
    $message    = sprintf('<a href="%s" class="button">%s</a> %s', 
$return_to, __('Continue Shopping &rarr;', 'woocommerce'), __('Product 
 successfully added to your cart.', 'woocommerce') );
else :
    $message    = sprintf('<a href="%s" class="button">%s</a> %s', 
get_permalink(woocommerce_get_page_id('cart')), __('View Cart &rarr;', 
'woocommerce'), __('Product successfully added to your cart.', 
'woocommerce') );
endif;
    return $message;
}
/* Custom Add To Cart Messages */

0 个答案:

没有答案