WC_Meta_Box_Order_Data::order_shipping_matches_billing
Whether an order's shipping address is still the billing-derived copy.
Store API checkout copies the billing address into the shipping address for backwards compatibility when a purchase needs no fulfillment. There is no persisted marker for that copy, so the shipping address is treated as billing-derived only while every copied field still matches billing. Once a merchant or integration edits the shipping fields to diverge, the values are explicit and must be shown. Individual getters use the edit context instead of get_address() so view filters cannot make distinct persisted values appear equal.
Method of the class: WC_Meta_Box_Order_Data{}
No Hooks.
Returns
bool.
Usage
$result = WC_Meta_Box_Order_Data::order_shipping_matches_billing( $order );
- $order(WC_Order) (required)
- Order object.
WC_Meta_Box_Order_Data::order_shipping_matches_billing() WC Meta Box Order Data::order shipping matches billing code WC 11.1.2
private static function order_shipping_matches_billing( $order ) {
$copied_fields = array( 'first_name', 'last_name', 'company', 'address_1', 'address_2', 'city', 'state', 'postcode', 'country', 'phone' );
foreach ( $copied_fields as $field ) {
if ( $order->{"get_shipping_$field"}( 'edit' ) !== $order->{"get_billing_$field"}( 'edit' ) ) {
return false;
}
}
return true;
}