craftcms / commerce

Fully integrated ecommerce for Craft CMS.
https://craftcms.com/commerce
Other
227 stars 170 forks source link

[4.x]: Custom fields on addresses missing from admin view #3152

Closed rickmills closed 1 year ago

rickmills commented 1 year ago

What happened?

Description

When adding a custom field to addresses (e.g for a phone number) they are fully populated successfully during the checkout process, however do not show up in the admin order details page.

If you edit the order via the admin area and edit the address the fields do show on the edit form, and are correctly populated.

Steps to reproduce

  1. Add a new custom field to addresses, in this example its called Phone Number (handle phoneNumber)
  2. Proceed through the checkout and populate the new custom field for the phone number.
  3. Go to the order details in the admin area, the billing / shipping address will be displayed as usual, but the phone number field will be missing. (this is the bug)
  4. Click edit at the top right of the order details
  5. Click the cog dropdown icon on one of the addresses and then click edit address
  6. On the edit address screen you'll see your custom field is indeed working correctly and was populated, just not displayed.

Expected behavior

Having custom fields on an address are pretty important. Phone numbers are a common requirement for e-commerce sites, so having the ability to capture that as part of the address (because this is the most logical place in the order process to capture that) is important.

Not being able to see that phone number as an admin causes a huge amount of time to be wasted during the order processing, requiring you to jump through multiple clicks to get to the edit page to see the phone number due to it not being displayed on the order details.

Actual behavior

No custom fields are showing up on the admin order details screen.

Screenshot 2023-04-26 at 12 13 04

Craft CMS version

4.4.8

Craft Commerce version

4.2.7

PHP version

8.1

Operating system and version

Ubunty 22.04

Database type and version

MySQL 5.7.38

Image driver and version

N/A

Installed plugins and versions

N/A

pdaleramirez commented 1 year ago

@rickmills This is not a bug. This is the expected behavior on the current version. This would be a good enhancement.

bossanova808 commented 1 year ago

This IS a bug, by any reasonable definition, for an e-commerce system.

Any order taking & processing system must obviously display phone numbers in the processing area (at the very least - probably other custom fields too - but phone numbers, absolutely). This is just e-commerce 101, first day stuff.

(How something like this isn't accept and fixed/released within a day or two just boggles the mind. We're what - almost an entire year on since Commerce 4/Craft 4 and phone numbers aren't displayed in order processing - c'mon now!).

nfourtythree commented 1 year ago

Just a quick update on this, this is a similar request to https://github.com/craftcms/commerce/issues/3082 and as can be seen on that issue there is a feature request within Craft (https://github.com/craftcms/cms/discussions/12615) to allow greater control over how addresses are formatted/shown in the control panel.

Due to the addressing implementation in Craft, the phone number is not a native field and therefore not known to the addressing library. This means it is not output due to it being a custom field.

Will bring this up internally again and see what could be possible here.

Thanks.

bossanova808 commented 1 year ago

Labelling it a 'feature request' is just playing semantics - this is a very obvious functionality regression between V3 and V4.

You simply can't (reasonably) sell a $1000 e-commerce system that can't even display phone numbers with orders. And for anyone upgrading (which seems to be a very small number of Commerce folk unfortunately) it's an immediate and obvious loss of (daily used), really very basic functionality for anyone that actually runs a store. Yes, you can still get to them, but it's very cumbersome and a long, long way from the sort of UI quality and UX/AX experience Craft aspires to. (Frankly, when I do launch this in house it's going to be simply embarrassing to have to explain to our staff this very basic thing is now missing, and here's this clunky workaround).

The new address system has custom formatters - surely (even if a stop-gap measure) - at the least we should be able to write one of those and nominate that for use across the CP in our config?

bymayo commented 1 year ago

We've also had 2 clients flag a similar issue up that "Phone number isn't being collected at checkout". But when we checked it was, but because of this issue it looks like it's not.

Editing the order, then clicking Edit on to each address to get a phone number is not very productive.

lukeholder commented 1 year ago

Thanks for the feedback everyone.

We've submitted a pull request on the Craft CMS repo, proposing an enhancement that allows developers to customize the default address formatter. This enables extra information, such as custom field data, to be added to the address card.

https://github.com/craftcms/cms/pull/13242

We will close this issue once it is merged in.

lukeholder commented 1 year ago

Craft 4.5 is now out and fixes this issue. Thanks all.