new0
Neues Wissen einreichen

WooCommerce

Woocommerce Produkt nur in spezifischem Land kaufbar

Bei Änderung des Landes / bzw. initial bei Aufruf der Checkout page wird geprüft ob das richtige Land ausgewählt, ansonsten wird das Produkt entfernt und eine Meldung ausgegeben. localised script für AJAX wp_localize_script( ‚theme‘, ‚ajaxvar‘, array(‚ajaxurl‘ => admin_url( ‚admin-ajax.php‘ ), ’security‘ => wp_create_nonce(‚ajax_request‘))); Checkbox zum aktivieren der Funktion: function removeItemCountry() { $message = “; foreach( […]

mehr erfahren

price per unit / Preis pro Einheit

<?php if($base_unit && $unit && $unit_product && $price) : $price_per_unit = number_format(($base_unit / $unit_product) * $price, 2, ‚,‘, “)?> <div class=“c-price-per-unit“><?php echo get_woocommerce_currency_symbol().‘ ‚.$price_per_unit.‘ / ‚.$base_unit.$unit ?></div> <?php endif; ?>

mehr erfahren

Leerzeichen nach Währungssymbol

Woocommerce -> Settings -> Tab:Allgemein : Währungsoptionen -> Position des Währungssymbols: z.B. Links mit Freiraum

mehr erfahren

WooCommerce Update Cart Count

function woocommerce_header_add_to_cart_fragment( $fragments ) { $cart_count = WC()->cart->get_cart_contents_count(); $cart_content = “.$cart_count.“; if($cart_count > 0) { $cart_content = “.$cart_count.“; } $fragments[‚.c-customer-navigation__cart-count‘] = $cart_content; return $fragments; } add_filter( ‚woocommerce_add_to_cart_fragments‘, ‚woocommerce_header_add_to_cart_fragment‘ );

mehr erfahren