du13520157325 2017-06-28 05:20
浏览 90
已采纳

挂入woocommerce购物车和结帐

I am trying to get a process-bar above cart and checkout in Wordpress like in this picture:

enter image description here

Therefor I tried to hook into both pages on functions.php But maybe I am doing sth. obviously wrong (I am beginner), as this page is down, when I implement the following code:

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>'
}

Whats wrong with that code? Please help me getting into this logic. Thank you! :-)

  • 写回答

1条回答 默认 最新

  • douping1993 2017-08-08 23:49
    关注

    I found a Solution:

     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>';
    }
    

    Custom CSS on Cart and Checkout:

    ul.breadcrumb-checkout {
        margin: 0px 10px 20px;
    }
    
    ul.breadcrumb-checkout li {
        display: inline-block;
        height: 30px;
        line-height: 30px;
        width: 200px;
        margin: 5px 10px 0 0;
        position: relative;
        text-align:center;
    }
    
    ul.breadcrumb-checkout li:before {
        content: " ";
        height: 0;
        width: 0;
        position: absolute;
        left: -2px;
        border-style: solid;
        border-width: 15px 0 15px 15px;
        border-color: transparent transparent transparent #fff;
        z-index: 0;
    }
    
    ul.breadcrumb-checkout li:first-child:before {
        border-color: transparent;
    }
    
    ul.breadcrumb-checkout li a:after {
        content: " ";
        height: 0;
        width: 0;
        position: absolute;
        right: -15px;
        border-style: solid;
        border-width: 15px 0 15px 15px;
        border-color: transparent transparent transparent #F3F3F3;
        z-index: 10;
    }
    
    ul.breadcrumb-checkout li.active a {
        background: #009DD9;
        z-index: 100;
        color: white;
    }
    
    ul.breadcrumb-checkout li.active a:after {
        border-left-color: #009DD9;
    }
    
    ul.breadcrumb-checkout li a {
        display: block;
        background: #F3F3F3;
    }
    
    ul.breadcrumb-checkout li a:hover {
        background: #3CA6DE;
    }
    
    ul.breadcrumb-checkout li a:hover:after {
        border-color: transparent transparent transparent #3CA6DE; 
    }
    
    .breadcrumb-checkout a {
        text-decoration: none;
        color: #817D7D;
    }
    
    .breadcrumb-checkout{
        text-align:center;
    }
    
    @media (max-width:680px){
        .breadcrumb_text{
            display:none;
        }
        ul.breadcrumb-checkout li{
            width: 80px;
        }
    }
    

    Ends up like this enter image description here

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#.net#的问题:End Function
  • ¥15 无法import pycausal
  • ¥15 VS2022创建MVC framework提示:预安装的程序包具有对缺少的注册表值的引用
  • ¥15 weditor无法连接模拟器Local server not started, start with?
  • ¥20 6-3 String类定义
  • ¥15 嵌入式--定时器使用
  • ¥20 51单片机学习中的问题
  • ¥30 Windows Server 2016利用兩張網卡處理兩個不同網絡
  • ¥15 Python中knn问题
  • ¥15 使用C#,asp.net读取Excel文件并保存到Oracle数据库