Slet / fjern detaljer fra kassen i WooCommerce (postkode, firma, telefon …)

WooCommerce este un sistem foarte simplu pentru oricine doreste sa creeze un magazin online, avand la baza WordPress.
La instalarea default, WooCommerce va adauga un formular standard pentru detaliile de facturare. In pagina deCheckouta clientului.
Conceput ca un sistem de magazin online care sa permita atat livrarea unor produse fizice cat si descarcarea unora virtuale, WooCommerce cere in formularul standard o serie de date ale clientului: Nume, Prenume, Numar de telefon, Tara, Adresa, Oras, Cod Postal. Unele dintre aceste campuri nu ne sunt necesare pentru o comanda virtuala de exemplu. Un produs care sa poata fi descarcat sau un produs care a fost platit prin PayPal nu ar avea nevoie de datele pentru livrare. In acest caz este bine sa usuram sistemul de comanda pentru utilizator, prin eliminarea unor campuri din Checkout.

Eliminarea campuluiCod Postaldin WooCommerce Checkout

Sa putem eliminaCodul Postal/ Billing Postcode din WooCommerce, trebuie sa mergem si sa editam fisierul functions.php al temei de WordPress care este activa pe website. In functions.php adaugam liniile:

add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
function custom_override_checkout_fields( $fields ) {
unset($fields['billing']['billing_postcode']);
return $fields;
}

Undebilling_postcodeeste campul pentru codul postal. Daca dorim sa eliminam al doilea camp de adresa, vom inlocuibilling_postcode” cu “billing_address_2”.

 unset($fields['billing']['billing_address_2']);

Sunt situatii in care s-ar putea sa nu intereseze niciun detaliu de plata al clientului. De regula atunci cand plata se face prin PayPal. In acest scenariu putem alege sa eliminam toate campurile din pagina de comanda.

add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
function custom_override_checkout_fields( $fields ) {
unset($fields['billing']['billing_postcode']);
unset($fields['billing']['billing_country']);
unset($fields['billing']['billing_state']);
unset($fields['billing']['billing_phone']);
unset($fields['order']['order_comments']);
unset($fields['billing']['billing_address_2']);
unset($fields['billing']['billing_postcode']);
unset($fields['billing']['billing_company']);
unset($fields['billing']['billing_last_name']);
unset($fields['billing']['billing_email']);
unset($fields['billing']['billing_city']);
return $fields;
}

In acest fel veti sterge toate campurile din WooCommerce Checkout.

Jeg er lidenskabelig med teknologi og skriver med glæde på stealthsetts.com startende med 2006. Jeg har en rig oplevelse i operativsystemer: macOS, Windows og Linux, men også inden for programmeringssprog og blogplatforme (WordPress) og til online butikker (Woocommerce, Magento, Presashop).

Hjem Din kilde til it -tutorials, nyttige tip og nyheder. Slet / fjern detaljer fra kassen i WooCommerce (postkode, firma, telefon …)

6 Tanker om “Slet / fjern detaljer fra kassen i WooCommerce (postkode, firma, telefon …)”

  1. Bonjour Merci pour ce post !
    J’avais besoin de supprimer le nom de l’entreprise et c’est parfait ça a fonctionné !!
    Je souhaite supprimer également le nom de l’entreprise surexpédier à une adresse différente”.
    mais je ne sais pas par quoi remplacer custom_override_checkout_fields dans votre code. Pourriez vous m’aider ?

    Svar
  2. Hi,I added this code to functions.php as guided but my website crashed. It’s totally blank. I’m not totally new to stuff like this but i’m not a pro either.

    If i could access my dashboard, i would just erase it but i cannot access anything on my website at all.

    Please help, what should i do? Urgent response needed please!

    Svar
  3. Merhaba
    Ben ödeme kısmında kifatura bilgileriyazısınıteslimat adresiolarak değiştirmek istiyorum. Ne yapabiliriz.

    Svar
    • Hej,
      Yes, is a good ideea in customizer but in the latest version of Woo I see onlyaddress 2”, “company. For postal code and oher fileds is req functions code to hide.

      Svar
Efterlad en kommentar