Fix amount logic in cart

This commit is contained in:
carmenmaymo 2023-09-10 11:21:58 +02:00
parent 8acfc94002
commit 465f41b34b
No known key found for this signature in database
GPG key ID: 6023F686B0F3102E
2 changed files with 6 additions and 12 deletions

View file

@ -546,9 +546,6 @@ class ApplePayButton implements ButtonInterface {
);
}
if ( $cart->needs_shipping() ) {
if ( ! $shipping_method ) {
return array();
}
list(
$shipping_methods_array, $selected_shipping_method
) = $this->cart_shipping_methods(
@ -602,14 +599,14 @@ class ApplePayButton implements ButtonInterface {
*
* @param WC_Cart $cart WC Cart instance.
* @param array $customer_address Customer address.
* @param array $shipping_method Shipping method.
* @param array|null $shipping_method Shipping method.
* @param string $shipping_method_id Shipping method id.
*/
protected function cart_shipping_methods(
$cart,
$customer_address,
$shipping_method,
$shipping_method_id
$shipping_method = null,
$shipping_method_id = ''
): array {
$shipping_methods_array = array();
@ -731,9 +728,6 @@ class ApplePayButton implements ButtonInterface {
}
if ( $cart->needs_shipping() ) {
if ( ! $shipping_method ) {
return array();
}
list(
$shipping_methods_array, $selected_shipping_method
) = $this->cart_shipping_methods(

View file

@ -43,7 +43,7 @@ class ApplePayDataObjectHttp {
*
* @var mixed
*/
protected $product_id;
protected $product_id = '';
/**
* The caller page.
@ -55,9 +55,9 @@ class ApplePayDataObjectHttp {
/**
* The product quantity.
*
* @var mixed
* @var string
*/
protected $product_quantity;
protected $product_quantity = '';
/**
* The shipping methods.