挂入woocommerce购物车和结帐

时间:2017-06-28 05:20:53

标签: php wordpress woocommerce hook hook-woocommerce

我正试图在购物车上方获得一个流程栏,并在WordPress中结帐,如下图所示:

enter image description here

因此我试图在functions.php上挂钩两个页面 但也许我在做某事。显然是错的(我是初学者),因为这个页面已关闭,当我实现以下代码时:

add_action( 'woocommerce_before_cart', 'process_a');
function process_a() {
    echo '<span class="warenkorb">1. Warenkorb</span> <a href="https://www.example.de/checkout"><span class="kasse">2. Kasse</span></a>'
}

add_action( 'woocommerce_before_checkout_form', 'process_b');
function process_b() {
    echo '<a href="http://www.example.de/cart"><span class="warenkorb">1. Warenkorb</span></a> <span class="kasse">2. Kasse</span>'
}

该代码有什么问题?请帮助我进入这个逻辑。谢谢! : - )

1 个答案:

答案 0 :(得分:2)

我找到了解决方案:

using System.Net;

public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, TraceWriter log)
{
    var path = Environment.GetEnvironmentVariable("HOME").ToString() + "\\site\\wwwroot\\HttpTriggerCSharp1\\schema.json";

    string readText = File.ReadAllText(path);

    log.Info(readText);
    return req.CreateResponse(HttpStatusCode.OK, "Hello ");
}

购物车和结帐时的自定义CSS:

 add_action( 'woocommerce_before_cart', 'process_a');
function process_a() {
echo '<ul class="breadcrumb-checkout"><li class="active"><a href="#"><i class="fa fa-shopping-cart" aria-hidden="true"></i> <span class="breadcrumb_text">Warenkorb</span></a></li><li><a href="https://YOURSITE.com/kasse"><i class="fa fa-credit-card" aria-hidden="true"></i> <span class="breadcrumb_text">Kasse</span></a></li><li><a href="#"><i class="fa fa-check" aria-hidden="true"></i> <span class="breadcrumb_text">Bestellbestätigung</span></a></li></ul>';
}

add_action( 'woocommerce_before_checkout_form', 'process_b');
function process_b() {
echo '<ul class="breadcrumb-checkout"><li><a href="https://YOURSITE.com/warenkorb"><i class="fa fa-shopping-cart" aria-hidden="true"></i> <span class="breadcrumb_text">Warenkorb</span></a></li><li class="active"><a href="#"><i class="fa fa-credit-card" aria-hidden="true"></i> <span class="breadcrumb_text">Kasse</span></a></li><li><a href="#"><i class="fa fa-check" aria-hidden="true"></i> <span class="breadcrumb_text">Bestellbestätigung</span></a></li></ul>';
}

这样结束 enter image description here