• Thanks for the useful plugin.

    The Checkout Totals Block is now used on the checkout page when using the block theme.

    Previously the shortcode [woocommerce_checkout] was used and the filter hook woocommerce_checkout_fields was applied, but this does not seem to be reflected in Checkout Totals Block. (I was selling digital data and this filter hook was erasing the address info)

    Is there some new solution for Checkout Totals Block to erase the fields?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Kader Ibrahim S. a11n

    (@kaderibrahim)

    Hello @inc2734,

    Thank you for reaching out to WooCommerce support. I understand you switched from using the [woocommerce_shortcode] to the WooCommerce checkout block.

    The WooCommerce checkout block currently does not support the woocommerce_checkout_fields fields. You can currently add custom fields to the checkout by adding a new inner block to the address area and rendering an input inside it.

    We did something similar in?this test plugin?to render a checkout box for subscribing to a newsletter. You can follow the same format to add custom fields elsewhere on the Checkout block.

    Hope this helps. Please let us know if you have more questions or need further help.

    Thread Starter Takashi Kitajima

    (@inc2734)

    You can currently add custom fields to the checkout by adding a new inner block to the address area and rendering an input inside it.

    I understand that I can add, but what I want to do is delete fields.

    Specifically, I want to keep only “Last name”, “First name”, and “Country” and delete “Postal code”, “Prefecture”, “City”, and “Address”.

    “Apertment” and “Phone” can be deleted in the settings, but not the aforementioned ones.

    Is there any way to delete these now?

    Plugin Support Kader Ibrahim S. a11n

    (@kaderibrahim)

    I reached out to the team that develops the Checkout blocks and I am told that it is not recommended to remove the fields as they could have unintended consequences like breaking tax for example.

    At this point, we do not have documentation on how to remove it. Alternatively, you can use the filter woocommerce_get_country_locale to filter out the fields.

    https://github.com/woocommerce/woocommerce/blob/124aeb746710a258f4d66dec4d333dd6cc9818dc/includes/class-wc-countries.php#L795

    Hope this helps.

    Thread Starter Takashi Kitajima

    (@inc2734)

    Thank you for your research.

    Unfortunately, using the woocommerce_get_country_locale filter did not remove the checkout block field.

    I use the legacy block method.

    Plugin Support Shameem R. a11n

    (@shameemreza)

    Hi @inc2734

    I’m sorry to hear that the woocommerce_get_country_locale filter did not work for you. Since you’re using the legacy block method, you might want to consider using the woocommerce_checkout_fields filter instead, which allows you to unset specific fields in the checkout block.

    Let us know how that goes. Looking forward to helping you.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Checkout page does not reflect woocommerce_checkout_fields filter hook when usin’ is closed to new replies.