craftcms / commerce

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

[4.x]: Upgraded from Commerce 3 and CP order details page shows addresses with label "Address" instead of "Shipping / Billing Address" #3387

Closed moldedjelly closed 8 months ago

moldedjelly commented 9 months ago

What happened?

Description

Upgraded from Commerce 3 to 4 and Control Panel order details page shows Shipping and Billing addresses with label "Address" instead of distinguishing "Shipping / Billing Address" as the new orders do.

Steps to reproduce

  1. Upgrade a site with existing orders from Commerce 3 to Commerce 4.

Expected behavior

Old orders to show addresses labelled as "Shipping Address" and "Billing Address"

Actual behavior

Old orders only show addresses labelled as "Address" and "Address"

Craft CMS version

4.7.2

Craft Commerce version

4.4.1.1

PHP version

8.0.30

Operating system and version

docker - craftcms/nginx:8.0

Database type and version

docker - mariadb:10.3

Image driver and version

No response

Installed plugins and versions

No response

lukeholder commented 8 months ago

You can fix this by running the following SQL commands on 4.x

UPDATE content
SET title = 'Shipping Address'
WHERE elementId IN (
    SELECT shippingAddressId
    FROM commerce_orders
);
UPDATE content
SET title = 'Billing Address'
WHERE elementId IN (
    SELECT billingAddressId
    FROM commerce_orders
);

if you use a db table prefix, you would need to add the prefix to the table names in the above commands: xxx_commerce_orders and xxx_content

We will add a migration in the future that will clean this up.