Merged in feature/MAW-855-import-code-into-aws (pull request #2)

code import from pantheon

* code import from pantheon
This commit is contained in:
Tony Volpe
2023-12-04 23:08:14 +00:00
parent 8c9b1312bc
commit 8f4b5efda6
4766 changed files with 185592 additions and 239967 deletions

View File

@@ -98,7 +98,7 @@ class WC_Cart extends WC_Legacy_Cart {
*/
public function __construct() {
$this->session = new WC_Cart_Session( $this );
$this->fees_api = new WC_Cart_Fees( $this );
$this->fees_api = new WC_Cart_Fees();
// Register hooks for the objects.
$this->session->init();
@@ -120,6 +120,8 @@ class WC_Cart extends WC_Legacy_Cart {
public function __clone() {
$this->session = clone $this->session;
$this->fees_api = clone $this->fees_api;
$this->session->set_cart( $this );
}
/*
@@ -667,7 +669,7 @@ class WC_Cart extends WC_Legacy_Cart {
public function get_cart_contents_weight() {
$weight = 0.0;
foreach ( $this->get_cart() as $cart_item_key => $values ) {
foreach ( $this->get_cart() as $values ) {
if ( $values['data']->has_weight() ) {
$weight += (float) $values['data']->get_weight() * $values['quantity'];
}
@@ -684,7 +686,7 @@ class WC_Cart extends WC_Legacy_Cart {
public function get_cart_item_quantities() {
$quantities = array();
foreach ( $this->get_cart() as $cart_item_key => $values ) {
foreach ( $this->get_cart() as $values ) {
$product = $values['data'];
$quantities[ $product->get_stock_managed_by_id() ] = isset( $quantities[ $product->get_stock_managed_by_id() ] ) ? $quantities[ $product->get_stock_managed_by_id() ] + $values['quantity'] : $values['quantity'];
}
@@ -759,7 +761,7 @@ class WC_Cart extends WC_Legacy_Cart {
$product_qty_in_cart = $this->get_cart_item_quantities();
$current_session_order_id = isset( WC()->session->order_awaiting_payment ) ? absint( WC()->session->order_awaiting_payment ) : 0;
foreach ( $this->get_cart() as $cart_item_key => $values ) {
foreach ( $this->get_cart() as $values ) {
$product = $values['data'];
// Check stock based on stock-status.
@@ -818,7 +820,7 @@ class WC_Cart extends WC_Legacy_Cart {
$cross_sells = array();
$in_cart = array();
if ( ! $this->is_empty() ) {
foreach ( $this->get_cart() as $cart_item_key => $values ) {
foreach ( $this->get_cart() as $values ) {
if ( $values['quantity'] > 0 ) {
$cross_sells = array_merge( $values['data']->get_cross_sell_ids(), $cross_sells );
$in_cart[] = $values['product_id'];
@@ -908,7 +910,7 @@ class WC_Cart extends WC_Legacy_Cart {
public function get_cart_item_tax_classes() {
$found_tax_classes = array();
foreach ( WC()->cart->get_cart() as $item ) {
foreach ( $this->get_cart() as $item ) {
if ( $item['data'] && ( $item['data']->is_taxable() || $item['data']->is_shipping_taxable() ) ) {
$found_tax_classes[] = $item['data']->get_tax_class();
}
@@ -925,7 +927,7 @@ class WC_Cart extends WC_Legacy_Cart {
public function get_cart_item_tax_classes_for_shipping() {
$found_tax_classes = array();
foreach ( WC()->cart->get_cart() as $item ) {
foreach ( $this->get_cart() as $item ) {
if ( $item['data'] && ( $item['data']->is_shipping_taxable() ) ) {
$found_tax_classes[] = $item['data']->get_tax_class();
}
@@ -1536,7 +1538,7 @@ class WC_Cart extends WC_Legacy_Cart {
}
$needs_shipping = false;
foreach ( $this->get_cart_contents() as $cart_item_key => $values ) {
foreach ( $this->get_cart_contents() as $values ) {
if ( $values['data']->needs_shipping() ) {
$needs_shipping = true;
break;