Untitled
raw download clone
TEXT
views 34
,
size 3427 b
function is_store_open($html, $product)
{
    global $post;
    $post_id=$post->ID;
    if ((products_to_thursday()) && (is_store_open_thursday())) {
        $html = '<p>Sprzedaż została zamknięta. Zapraszamy ponownie w niedzielę. (CZWARTEK)</p>';
    } elseif ((!products_to_thursday()) && (is_store_open_friday())) {
        $html = '<p>Sprzedaż została zamknięta. Zapraszamy ponownie w niedzielę. (PIATEK)</p>';
    } else {
        if ($product && $product->is_type('simple') && $product->is_purchasable() && $product->is_in_stock() && !$product->is_sold_individually()) {
            $html = '<form action="' . esc_url($product->add_to_cart_url()) . '" class="cart" method="post" enctype="multipart/form-data">';
            $html .= woocommerce_quantity_input(array(), $product, false);
            $html .= '<button type="submit" class="button alt">' . esc_html($product->add_to_cart_text()) . '</button>';
            $html .= '</form>';

            if (products_to_thursday()) {
                $counter_content =
                    '
                    <div id="timer">
                      <span class="timer-info">Zamów w ciągu: </br></span>
                      <div class="dni">
                      <span class="days"> </span> <span class="days-text">dni</span>
                      </div>
                      <div class="godziny">
                      <span class="hours"></span> <span class="hours-text">godzin</span> 
                      </div>
                      <div class="minuty">
                      <span class="minutes"></span> <span class="text-minutes">minut</span>
                      </div>
                      <div class="sekundy">
                      <span class="seconds"></span> <span class="second-texts">sekund</span></br>
                      </div>
                      <div class="info-time">
                      <span class="timer-info-after">aby otrzymać produkt w najbliższą sobotę. </span>
                      </div>
                    </div>
                ';

                return $counter_content . $html;
            } else {
                $counter_content =
                    ' 
                    <div id="timer2"> 
                      <span class="timer-info">Zamów w ciągu: </br></span>
                      <div class="dni2">
                      <span class="days2"> </span> <span class="days-text2">dni</span> 
                      </div> 
                      <div class="godziny2">
                      <span class="hours2"></span> <span class="hours-text2">godzin</span> 
                      </div>
                      <div class="minuty2">
                      <span class="minutes2"></span> <span class="text-minutes2">minut</span>
                      </div>
                      <div class="sekundy2">
                      <span class="seconds2"></span> <span class="second-texts2">sekund</span></br>
                      </div> 
                      <div class="info-time">
                        <span class="timer-info-after">aby otrzymać produkt w najbliższą  sobotę. </span>
                    </div>
                    </div>
        ';
                return $counter_content . $html;
            }
        }
    }

    return $html;


}

add_filter('woocommerce_loop_add_to_cart_link', 'is_store_open', 10, 2);
close fullscreen
Login or Register to edit or fork this paste. It's free.