1
0
Fork 0
mirror of synced 2025-04-06 07:13:33 +03:00

Add filters into class-wc-retailcrm-order-address.php

This commit is contained in:
makaravich 2021-03-19 09:16:33 +03:00
parent 84d36f7c33
commit ac89d992b7

View file

@ -14,14 +14,16 @@ class WC_Retailcrm_Order_Address extends WC_Retailcrm_Abstracts_Address
/** @var string $filter_name */
protected $filter_name = 'order_address';
/**
* @param WC_Order $order
*
* @return self
*/
public function build($order)
{
$address = $this->getOrderAddress($order);
/**
* @param WC_Order $order
*
* @return self
*/
public function build( $order )
{
$address = $order->get_address($this->address_type);
$address = apply_filters( 'wc_retail_crm_order_address', $address, $order, $this->address_type );
if (!empty($address)) {
$data = array(
@ -33,14 +35,18 @@ class WC_Retailcrm_Order_Address extends WC_Retailcrm_Abstracts_Address
$this->set_data_fields($data);
}
$this->set_data_field('text', sprintf(
"%s %s %s %s %s",
$address['postcode'],
$address['state'],
$address['city'],
$address['address_1'],
$address['address_2']
));
$formatted = sprintf(
"%s %s %s %s %s",
$address['postcode'],
$address['state'],
$address['city'],
$address['address_1'],
$address['address_2']
);
$formatted = apply_filters( 'wc_retail_crm_formatted_address', $formatted, $address );
$this->set_data_field( 'text', $formatted );
return $this;
}