WP的Woocommerce中wc_add_to_cart_message挂钩的替代方案

ber*_*rom 5 wordpress woocommerce

我使用Woocommerce中的add to cart消息钩来编辑文本并从某些按钮中删除一些类.看来这个钩子现在在Woocommerce 2.1中被弃用了,我找不到替代品.

我想从"继续购物"按钮中删除"按钮"类.这个类在Woocommerce核心中定义,我想留下未经编辑的未来更新.

我正在尝试编辑的行位于woocommerce/includes/wc-cart-functions.php第94行.

$message = sprintf('<a href="%s" class="button wc-forward">%s</a> %s', $return_to, __( 'Continue Shopping', 'woocommerce' ), $added_text );
Run Code Online (Sandbox Code Playgroud)

有没有人为这个钩子找到合适的替代品呢?提前致谢!

Sr.*_*DRO 11

这对我有用

add_filter( 'wc_add_to_cart_message', 'custom_add_to_cart_message' );
function custom_add_to_cart_message() {
    global $woocommerce;

        $return_to  = get_permalink(woocommerce_get_page_id('shop'));
        $message    = sprintf('<a href="%s" class="button wc-forwards">%s</a> %s', $return_to, __('Continue Shopping', 'woocommerce'), __('Product successfully added to your cart.', 'woocommerce') );
    return $message;
}
Run Code Online (Sandbox Code Playgroud)

编辑:感谢Kaarel Kaspar的修正