Field kodepos tidak bisa dibuat opsional
Updated on February 4, 2022 in Plugin Ongkos Kirim
Premium  6 on February 1, 2022

Di plugin sebelumnya (versi 3.7.5) untuk field kode pos masih bisa dibuat jadi opsional dengan menggunakan filter ini:


add_filter( ‘woocommerce_checkout_fields’ , ‘postcode_optional’ );

function postcode_optional( $fields ) {
$fields[‘billing’][‘billing_postcode’][‘required’] = false;
$fields[‘shipping’][‘shipping_postcode’][‘required’] = false;
return $fields;
}

Namun di versi terbaru tidak bisa.

Bagaimana cara agar field kode pos bisa jadi opsional? Karena field ini berpotensi menurunkan conversion rate untuk target market kami.

Terima kasih.

  • Liked by
Support Hours:
Weekdays: 09.00 - 17.00
Weekend: Off
Sorry, our support is not available at this time. We will reply at the next working hour.

By using the forum you are agree with tonjoo studio license agreement

Moderator 0 on February 3, 2022

coba gunakan hook berikut:


add_filter( ‘woocommerce_get_country_locale’, ‘postcode_optional’ );
function postcode_optional($fields) {
$fields[‘ID’][‘postcode’][‘required’] = false;
return $fields;
}
  • Liked by
Cancel
Support Hours:
Weekdays: 09.00 - 17.00
Weekend: Off
Sorry, our support is not available at this time. We will reply at the next working hour.

By using the forum you are agree with tonjoo studio license agreement

Message :
Premium  0 on February 3, 2022

Terima kasih responnya, barusan sudah kami coba hooknya.

Dan tetap field kode pos nya gak bisa opsional, lalu kami coba kode tersebut juga di plugin ongkir sebelumnya yang versi 3.7.5 dan berfungsi dengan baik.

Jadi memang hanya di versi baru (3.8.4) yang gak berfungsi hooknya. Apakah ada solusi hook lain?

Terima kasih.

  • Liked by
Cancel
Support Hours:
Weekdays: 09.00 - 17.00
Weekend: Off
Sorry, our support is not available at this time. We will reply at the next working hour.

By using the forum you are agree with tonjoo studio license agreement

Message :
Moderator 0 on February 3, 2022

apakah sudah dipastikan tidak ada kode lain atau config yang menyababkan kodepos menjadi required?

kami sudah mencoba hook yang kami kirim tadi di staging.blanjaini.com dan berhasil menjadikan kodepos opsional.

atau coba naikkan priority hook yang digunakan.

  • Liked by
Cancel
Support Hours:
Weekdays: 09.00 - 17.00
Weekend: Off
Sorry, our support is not available at this time. We will reply at the next working hour.

By using the forum you are agree with tonjoo studio license agreement

Message :
Premium  0 on February 3, 2022

Iya, setelah di cek di situs staging bisa, di situs live nya yang gak bisa.

Tapi kenapa untuk versi yang 3.7.5 sebelumnya bisa yah?

Kita sudah coba naikin priority hook nya juga, tapi tetap gak bisa.

  • Liked by
Cancel
Support Hours:
Weekdays: 09.00 - 17.00
Weekend: Off
Sorry, our support is not available at this time. We will reply at the next working hour.

By using the forum you are agree with tonjoo studio license agreement

Message :
0 on February 4, 2022

sempat mengalami masalah yang sama, saya gunakan hook ini dan berhasil:

// Make zip/postcode field optional
add_filter( ‘woocommerce_default_address_fields’ , ‘QuadLayers_optional_postcode_checkout’ );
function QuadLayers_optional_postcode_checkout( $p_fields ) {
$p_fields[‘postcode’][‘required’] = false;
return $p_fields;
}

  • Liked by
Cancel
Support Hours:
Weekdays: 09.00 - 17.00
Weekend: Off
Sorry, our support is not available at this time. We will reply at the next working hour.

By using the forum you are agree with tonjoo studio license agreement

Message :
Premium  0 on February 4, 2022

Terima kasih bantuannya ardhifabel24.

Sudah ketemu masalahnya, ternyata filternya tidak bisa digunakan di plugin snippets, walaupun sudah di set priority nya jadi pertama, tapi tetap gk berfungsi.

Setelah dicoba masukkan filter langsung ke child theme, bisa berfungsi dengan normal.

  • Liked by
Cancel
Support Hours:
Weekdays: 09.00 - 17.00
Weekend: Off
Sorry, our support is not available at this time. We will reply at the next working hour.

By using the forum you are agree with tonjoo studio license agreement

Message :
Loading more replies
You are not logged in

Please login here or simply sign up here .