更改woocommerce查看购物车消息顺序

时间:2018-07-04 09:47:41

标签: woocommerce

出于我的主题,出于某种原因,当将产品添加到购物车时,您会收到如下所示的woocommerce消息:

“查看购物车”项目已添加到您的购物车。

“查看购物车”按钮出现在文本之前。有没有办法改变顺序?我最近发现的位置在wc-cart-functions.php文件中:

// Output success messages.
    if ( 'yes' === get_option( 'woocommerce_cart_redirect_after_add' ) ) {
        $return_to = apply_filters( 'woocommerce_continue_shopping_redirect', wc_get_raw_referer() ? wp_validate_redirect( wc_get_raw_referer(), false ) : wc_get_page_permalink( 'shop' ) );
        $message   = sprintf( '<a href="%s" class="button wc-forward">%s</a> %s', esc_url( $return_to ), esc_html__( 'Continue shopping', 'woocommerce' ), esc_html( $added_text ) );
    } else {
        $message = sprintf( '<a href="%s" class="button wc-forward">%s</a> %s', esc_url( wc_get_page_permalink( 'cart' ) ), esc_html__( 'View cart', 'woocommerce' ), esc_html( $added_text ) );
    }

    if ( has_filter( 'wc_add_to_cart_message' ) ) {
        wc_deprecated_function( 'The wc_add_to_cart_message filter', '3.0', 'wc_add_to_cart_message_html' );
        $message = apply_filters( 'wc_add_to_cart_message', $message, $product_id );
    }

    $message = apply_filters( 'wc_add_to_cart_message_html', $message, $products );

    if ( $return ) {
        return $message;
    } else {
        wc_add_notice( $message );
    }
}

但是我在这里所做的任何更改似乎都没有任何输出。我可以在functions.php中创建一些东西来更改按钮的顺序吗?

谢谢您的回答。

0 个答案:

没有答案