Fix merge conflicts

This commit is contained in:
dinamiko 2021-10-20 15:01:53 +02:00
commit e3a793e3e5
12 changed files with 236 additions and 113 deletions

View file

@ -204,6 +204,10 @@ class OrderEndpoint {
: ApplicationContext::SHIPPING_PREFERENCE_GET_FROM_FILE
: ApplicationContext::SHIPPING_PREFERENCE_NO_SHIPPING;
if ( $this->has_items_without_shipping( $items ) ) {
$shipping_preferences = ApplicationContext::SHIPPING_PREFERENCE_NO_SHIPPING;
}
$bearer = $this->bearer->bearer();
$data = array(
'intent' => ( $this->subscription_helper->cart_contains_subscription() || $this->subscription_helper->current_product_is_subscription() ) ? 'AUTHORIZE' : $this->intent,
@ -583,4 +587,20 @@ class OrderEndpoint {
$new_order = $this->order( $order_to_update->id() );
return $new_order;
}
/**
* Checks if there is at least one item without shipping.
*
* @param array $items The items.
* @return bool Whether items contains shipping or not.
*/
private function has_items_without_shipping( array $items ): bool {
foreach ( $items as $item ) {
if ( ! $item->shipping() ) {
return true;
}
}
return false;
}
}