Merge pull request #15547 from woocommerce/fix/15543
Fix undefined/incorrectly used variables
This commit is contained in:
commit
894c77b0f7
|
@ -297,7 +297,7 @@ abstract class WC_REST_Terms_Controller extends WC_REST_Controller {
|
|||
$prepared_args = apply_filters( "woocommerce_rest_{$taxonomy}_query", $prepared_args, $request );
|
||||
|
||||
if ( ! empty( $prepared_args['product'] ) ) {
|
||||
$query_result = $this->get_terms_for_product( $prepared_args );
|
||||
$query_result = $this->get_terms_for_product( $prepared_args, $request );
|
||||
$total_terms = $this->total_terms;
|
||||
} else {
|
||||
$query_result = get_terms( $taxonomy, $prepared_args );
|
||||
|
@ -618,9 +618,10 @@ abstract class WC_REST_Terms_Controller extends WC_REST_Controller {
|
|||
* are instead treated as a full query.
|
||||
*
|
||||
* @param array $prepared_args Arguments for `get_terms()`.
|
||||
* @param WP_REST_Request $request Full details about the request.
|
||||
* @return array List of term objects. (Total count in `$this->total_terms`).
|
||||
*/
|
||||
protected function get_terms_for_product( $prepared_args ) {
|
||||
protected function get_terms_for_product( $prepared_args, $request ) {
|
||||
$taxonomy = $this->get_taxonomy( $request );
|
||||
|
||||
$query_result = get_the_terms( $prepared_args['product'], $taxonomy );
|
||||
|
|
|
@ -1555,7 +1555,7 @@ class WC_API_Orders extends WC_API_Resource {
|
|||
}
|
||||
|
||||
$order_refund = array(
|
||||
'id' => $refund->id,
|
||||
'id' => $refund->get_id(),
|
||||
'created_at' => $this->server->format_datetime( $refund->get_date_created() ? $refund->get_date_created()->getTimestamp() : 0, false, false ),
|
||||
'amount' => wc_format_decimal( $refund->get_amount(), 2 ),
|
||||
'reason' => $refund->get_reason(),
|
||||
|
@ -1637,9 +1637,9 @@ class WC_API_Orders extends WC_API_Resource {
|
|||
// HTTP 201 Created
|
||||
$this->server->send_status( 201 );
|
||||
|
||||
do_action( 'woocommerce_api_create_order_refund', $refund->id, $order_id, $this );
|
||||
do_action( 'woocommerce_api_create_order_refund', $refund->get_id(), $order_id, $this );
|
||||
|
||||
return $this->get_order_refund( $order_id, $refund->id );
|
||||
return $this->get_order_refund( $order_id, $refund->get_id() );
|
||||
} catch ( WC_Data_Exception $e ) {
|
||||
return new WP_Error( $e->getErrorCode(), $e->getMessage(), array( 'status' => 400 ) );
|
||||
} catch ( WC_API_Exception $e ) {
|
||||
|
|
|
@ -1602,7 +1602,7 @@ class WC_API_Orders extends WC_API_Resource {
|
|||
}
|
||||
|
||||
$order_refund = array(
|
||||
'id' => $refund->id,
|
||||
'id' => $refund->get_id(),
|
||||
'created_at' => $this->server->format_datetime( $refund->get_date_created() ? $refund->get_date_created()->getTimestamp() : 0, false, false ),
|
||||
'amount' => wc_format_decimal( $refund->get_amount(), 2 ),
|
||||
'reason' => $refund->get_reason(),
|
||||
|
@ -1684,9 +1684,9 @@ class WC_API_Orders extends WC_API_Resource {
|
|||
// HTTP 201 Created
|
||||
$this->server->send_status( 201 );
|
||||
|
||||
do_action( 'woocommerce_api_create_order_refund', $refund->id, $order_id, $this );
|
||||
do_action( 'woocommerce_api_create_order_refund', $refund->get_id(), $order_id, $this );
|
||||
|
||||
return $this->get_order_refund( $order_id, $refund->id );
|
||||
return $this->get_order_refund( $order_id, $refund->get_id() );
|
||||
} catch ( WC_Data_Exception $e ) {
|
||||
return new WP_Error( $e->getErrorCode(), $e->getMessage(), array( 'status' => 400 ) );
|
||||
} catch ( WC_API_Exception $e ) {
|
||||
|
|
Loading…
Reference in New Issue