• Resolved Blipp

    (@blipp)


    This seems such a simple requirement but I cannot find anywhere to tell me how to do it. I simply need to have a phone number field on the checkout page which is a required field. I have the phone field but it is optional – I just need to make it mandatory.

    • This topic was modified 6 months, 2 weeks ago by Blipp.

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter Blipp

    (@blipp)

    I should probably clarify something here – I am using the woocommerce block code on my checkout page so it looks like this –

    div class=”wp-block-woocommerce-checkout-contact-information-block

    and so on.

    If I go to Appearance > Customise > Checkout – I do not get the options to customise the checkout page, instead I get the option to edit the blocks only. If I revert back to the default woo checkout shortcode I do get the options to customise the checkout fields and the phone field is already set to ‘required’, but when I change back to the block code the phone fields shows as ‘optional’

    The problem seems to relate to using the block code for the checkout so I guess the question should be how can I edit the block code so the phone field is required?

    Plugin Support ckadenge (woo-hc)

    (@ckadenge)

    Hi there ,

    If I go to Appearance > Customise > Checkout – I do not get the options to customise the checkout page, instead I get the option to edit the blocks only.

    The settings from the “Appearance > Customize > WooCommerce > Checkout” page aren’t reflected on the checkout block. You should use the “Pages -> Checkout” page to change the settings.

    In order to avoid confusions, the settings from the “Appearance > Customize > WooCommerce > Checkout” page will be removed in the near future (here is the WooCommerce GitHub issue).

    On the “Pages -> Checkout” page you’ll find several other settings for adjusting the checkout form to your wishes. You can also add Paragraph/Image/Separator inner blocks inside the checkout block, by clicking the plus sign under the blocks.

    You can find more information on a similar issue from this thread.

    I hope that helps.

    Thread Starter Blipp

    (@blipp)

    I do not get any options since I have inserted code on the checkout page to create the layout. Perhaps the theme I am using is preventing me seeing other optins but the code I have inserted looks like as below. I guess what I need to know if can I edit any of these blocks and insert additional code to for the phone number field to be required.

    <!-- wp:woocommerce/checkout -->
    <div class="wp-block-woocommerce-checkout wc-block-checkout is-loading"><!-- wp:woocommerce/checkout-fields-block -->
    <div class="wp-block-woocommerce-checkout-fields-block"><!-- wp:woocommerce/checkout-express-payment-block -->
    <div class="wp-block-woocommerce-checkout-express-payment-block">?</div>
    <!-- /wp:woocommerce/checkout-express-payment-block -->
    
    <!-- wp:woocommerce/checkout-contact-information-block -->
    <div class="wp-block-woocommerce-checkout-contact-information-block">?</div>
    <!-- /wp:woocommerce/checkout-contact-information-block -->
    
    <!-- wp:woocommerce/checkout-shipping-address-block -->
    <div class="wp-block-woocommerce-checkout-shipping-address-block">?</div>
    <!-- /wp:woocommerce/checkout-shipping-address-block -->
    
    <!-- wp:woocommerce/checkout-billing-address-block -->
    <div class="wp-block-woocommerce-checkout-billing-address-block">?</div>
    <!-- /wp:woocommerce/checkout-billing-address-block -->
    
    <!-- wp:woocommerce/checkout-shipping-methods-block -->
    <div class="wp-block-woocommerce-checkout-shipping-methods-block">?</div>
    <!-- /wp:woocommerce/checkout-shipping-methods-block -->
    
    <!-- wp:woocommerce/checkout-payment-block -->
    <div class="wp-block-woocommerce-checkout-payment-block">?</div>
    <!-- /wp:woocommerce/checkout-payment-block -->
    
    <!-- wp:woocommerce/checkout-order-note-block -->
    <div class="wp-block-woocommerce-checkout-order-note-block">?</div>
    <!-- /wp:woocommerce/checkout-order-note-block -->
    
    <!-- wp:woocommerce/checkout-terms-block -->
    <div class="wp-block-woocommerce-checkout-terms-block">?</div>
    <!-- /wp:woocommerce/checkout-terms-block -->
    
    <!-- wp:woocommerce/checkout-actions-block -->
    <div class="wp-block-woocommerce-checkout-actions-block">?</div>
    <!-- /wp:woocommerce/checkout-actions-block --></div>
    <!-- /wp:woocommerce/checkout-fields-block -->
    
    <!-- wp:woocommerce/checkout-totals-block -->
    <p>&nbsp;</p>
    <div class="wp-block-woocommerce-checkout-totals-block"><!-- wp:woocommerce/checkout-order-summary-block -->
    <div class="wp-block-woocommerce-checkout-order-summary-block">?</div>
    <!-- /wp:woocommerce/checkout-order-summary-block --></div>
    <!-- /wp:woocommerce/checkout-totals-block --></div>
    <!-- /wp:woocommerce/checkout -->

    Hey, @blipp!

    By default, as my colleague explained, you can mark the phone as required on the checkout block on the checkout page.

    Here’s what it looks like:

    From what I understand it seems you modified the checkout page with custom code and it is preventing you from seeing this option, is that correct?

    If it is, please note we are not able to provide support for code customization as per our support policy.

    You can visit the WooCommerce Facebook group or the #developers channel of the WooCommerce Community Slack. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there too.

    Please let us know if there’s anything else we can do to help or if you have any questions.

    Have a wonderful day!

    Thread Starter Blipp

    (@blipp)

    I have not custimised the code, it is what is created by either woocommerce / wordpress or my theme to create the checout page. I think I have managed to do it now but it was a lot of faffing around. I had to revert back to a default theme and turn off a few theme related plugins to access the code elements you mentioned. Then make the changes and then reactivate the plugins and themes. I am left with slightly edited block code it seems and it would be so much easier if WordPress / woocommerce were to publish this code somewhere to I could have just used it as refernce for what I needed.

    Anyway for anyone interetsed here is the code it re-generated.

    <!-- wp:woocommerce/checkout {"requirePhoneField":true} -->
    <div class="wp-block-woocommerce-checkout alignwide wc-block-checkout is-loading"><!-- wp:woocommerce/checkout-fields-block -->
    <div class="wp-block-woocommerce-checkout-fields-block"><!-- wp:woocommerce/checkout-express-payment-block -->
    <div class="wp-block-woocommerce-checkout-express-payment-block"></div>
    <!-- /wp:woocommerce/checkout-express-payment-block -->
    
    <!-- wp:woocommerce/checkout-contact-information-block -->
    <div class="wp-block-woocommerce-checkout-contact-information-block"><!-- wp:mailpoet/marketing-optin-block -->
    <div class="wp-block-mailpoet-marketing-optin-block"></div>
    <!-- /wp:mailpoet/marketing-optin-block --></div>
    <!-- /wp:woocommerce/checkout-contact-information-block -->
    
    <!-- wp:woocommerce/checkout-shipping-method-block -->
    <div class="wp-block-woocommerce-checkout-shipping-method-block"></div>
    <!-- /wp:woocommerce/checkout-shipping-method-block -->
    
    <!-- wp:woocommerce/checkout-pickup-options-block -->
    <div class="wp-block-woocommerce-checkout-pickup-options-block"></div>
    <!-- /wp:woocommerce/checkout-pickup-options-block -->
    
    <!-- wp:woocommerce/checkout-shipping-address-block -->
    <div class="wp-block-woocommerce-checkout-shipping-address-block"></div>
    <!-- /wp:woocommerce/checkout-shipping-address-block -->
    
    <!-- wp:woocommerce/checkout-billing-address-block -->
    <div class="wp-block-woocommerce-checkout-billing-address-block"></div>
    <!-- /wp:woocommerce/checkout-billing-address-block -->
    
    <!-- wp:woocommerce/checkout-shipping-methods-block -->
    <div class="wp-block-woocommerce-checkout-shipping-methods-block"></div>
    <!-- /wp:woocommerce/checkout-shipping-methods-block -->
    
    <!-- wp:woocommerce/checkout-payment-block -->
    <div class="wp-block-woocommerce-checkout-payment-block"></div>
    <!-- /wp:woocommerce/checkout-payment-block -->
    
    <!-- wp:woocommerce/checkout-additional-information-block -->
    <div class="wp-block-woocommerce-checkout-additional-information-block"></div>
    <!-- /wp:woocommerce/checkout-additional-information-block -->
    
    <!-- wp:woocommerce/checkout-order-note-block -->
    <div class="wp-block-woocommerce-checkout-order-note-block"></div>
    <!-- /wp:woocommerce/checkout-order-note-block -->
    
    <!-- wp:woocommerce/checkout-terms-block -->
    <div class="wp-block-woocommerce-checkout-terms-block"></div>
    <!-- /wp:woocommerce/checkout-terms-block -->
    
    <!-- wp:woocommerce/checkout-actions-block -->
    <div class="wp-block-woocommerce-checkout-actions-block"></div>
    <!-- /wp:woocommerce/checkout-actions-block --></div>
    <!-- /wp:woocommerce/checkout-fields-block -->
    
    <!-- wp:woocommerce/checkout-totals-block -->
    <div class="wp-block-woocommerce-checkout-totals-block"><!-- wp:woocommerce/checkout-order-summary-block -->
    <div class="wp-block-woocommerce-checkout-order-summary-block"><!-- wp:woocommerce/checkout-order-summary-cart-items-block -->
    <div class="wp-block-woocommerce-checkout-order-summary-cart-items-block"></div>
    <!-- /wp:woocommerce/checkout-order-summary-cart-items-block -->
    
    <!-- wp:woocommerce/checkout-order-summary-coupon-form-block -->
    <div class="wp-block-woocommerce-checkout-order-summary-coupon-form-block"></div>
    <!-- /wp:woocommerce/checkout-order-summary-coupon-form-block -->
    
    <!-- wp:woocommerce/checkout-order-summary-subtotal-block -->
    <div class="wp-block-woocommerce-checkout-order-summary-subtotal-block"></div>
    <!-- /wp:woocommerce/checkout-order-summary-subtotal-block -->
    
    <!-- wp:woocommerce/checkout-order-summary-fee-block -->
    <div class="wp-block-woocommerce-checkout-order-summary-fee-block"></div>
    <!-- /wp:woocommerce/checkout-order-summary-fee-block -->
    
    <!-- wp:woocommerce/checkout-order-summary-discount-block -->
    <div class="wp-block-woocommerce-checkout-order-summary-discount-block"></div>
    <!-- /wp:woocommerce/checkout-order-summary-discount-block -->
    
    <!-- wp:woocommerce/checkout-order-summary-shipping-block -->
    <div class="wp-block-woocommerce-checkout-order-summary-shipping-block"></div>
    <!-- /wp:woocommerce/checkout-order-summary-shipping-block -->
    
    <!-- wp:woocommerce/checkout-order-summary-taxes-block -->
    <div class="wp-block-woocommerce-checkout-order-summary-taxes-block"></div>
    <!-- /wp:woocommerce/checkout-order-summary-taxes-block -->
    
    <!-- wp:woocommerce/checkout-order-summary-gift-card-form-block -->
    <div class="wp-block-woocommerce-checkout-order-summary-gift-card-form-block"></div>
    <!-- /wp:woocommerce/checkout-order-summary-gift-card-form-block -->
    
    <!-- wp:woocommerce/checkout-order-summary-gift-card-totals-block -->
    <div class="wp-block-woocommerce-checkout-order-summary-gift-card-totals-block"></div>
    <!-- /wp:woocommerce/checkout-order-summary-gift-card-totals-block --></div>
    <!-- /wp:woocommerce/checkout-order-summary-block --></div>
    <!-- /wp:woocommerce/checkout-totals-block --></div>
    <!-- /wp:woocommerce/checkout -->
    Plugin Support Shameem R. a11n

    (@shameemreza)

    HI @blipp

    I’m glad you were able to find a solution to your inquiry here and thanks for sharing it with the community too! ??

    I will mark this thread as resolved. Should you have further inquiries, kindly create a new topic here.

    Thanks!

    Hi,

    Is there a php hook to do this directly programmatically ?
    Thanks

    Plugin Support ckadenge (woo-hc)

    (@ckadenge)

    Hi @elpix,

    Is there a php hook to do this directly programmatically ?

    To align with?forum best practices, please create a new topic so that we can address your issue(s) separately.
    You can create a new thread here:?https://www.ads-software.com/support/plugin/woocommerce/#new-topic-0
    Thanks for understanding!

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.