How to show the new field if the user is guest. If the user logged in dont show the custom field which been created.

     public function process($result)
        if ($this->customerSession->isLoggedIn()) {
        } else {
            $result = $this->getShippingFormFields($result);
            $result = $this->getBillingFormFields($result);
            return $result;

I have tried doing this and I get Error code 500. Is there any way? I could show the new field for guest users ONLY if not continue as Normal.

I have created a date picker in checkout page

  • what is this custom field & where you want to show it? Oct 21 '19 at 9:04
  • @HassanAliShahzad i have updated my question Oct 21 '19 at 9:06
  • you know the place in the template where you are displaying it? Oct 21 '19 at 9:13
  • I havent touched phtml to show the field i have dont it through DI.XML <argument name="layoutProcessors" xsi:type="array"> <item name="guest_age_check" xsi:type="object">Module\PATH\Block\Checkout\LayoutProcessor</item> </argument> Oct 21 '19 at 9:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.