Add filters into class-wc-retailcrm-order-address.php
This commit is contained in:
parent
84d36f7c33
commit
ac89d992b7
1 changed files with 22 additions and 16 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue