Submit
Path:
~
/
home
/
getwphos
/
public_html
/
topdoggroomingny
/
wp-content
/
plugins
/
woocommerce
/
src
/
Internal
/
File Content:
RestockRefundedItemsAdjuster.php
<?php /** * RestockRefundedItemsAdjuster class file. */ namespace Automattic\WooCommerce\Internal; use Automattic\WooCommerce\Proxies\LegacyProxy; defined( 'ABSPATH' ) || exit; /** * Class to adjust or initialize the restock refunded items. */ class RestockRefundedItemsAdjuster { /** * The order factory to use. * * @var WC_Order_Factory */ private $order_factory; /** * Class initialization, to be executed when the class is resolved by the container. * * @internal */ final public function init() { $this->order_factory = wc_get_container()->get( LegacyProxy::class )->get_instance_of( \WC_Order_Factory::class ); add_action( 'woocommerce_before_save_order_items', array( $this, 'initialize_restock_refunded_items' ), 10, 2 ); } /** * Initializes the restock refunded items meta for order version less than 5.5. * * @see https://github.com/woocommerce/woocommerce/issues/29502 * * @param int $order_id Order ID. * @param array $items Order items to save. */ public function initialize_restock_refunded_items( $order_id, $items ) { $order = wc_get_order( $order_id ); $order_version = $order->get_version(); if ( version_compare( $order_version, '5.5', '>=' ) ) { return; } // If there are no refund lines, then this migration isn't necessary because restock related meta's wouldn't be set. if ( 0 === count( $order->get_refunds() ) ) { return; } if ( isset( $items['order_item_id'] ) ) { foreach ( $items['order_item_id'] as $item_id ) { $item = $this->order_factory::get_order_item( absint( $item_id ) ); if ( ! $item ) { continue; } if ( 'line_item' !== $item->get_type() ) { continue; } // There could be code paths in custom code which don't update version number but still update the items. if ( '' !== $item->get_meta( '_restock_refunded_items', true ) ) { continue; } $refunded_item_quantity = abs( $order->get_qty_refunded_for_item( $item->get_id() ) ); $item->add_meta_data( '_restock_refunded_items', $refunded_item_quantity, false ); $item->save(); } } } }
Edit
Rename
Chmod
Delete
FILE
FOLDER
Name
Size
Permission
Action
Abilities
---
0755
AddressProvider
---
0755
Admin
---
0755
BatchProcessing
---
0755
CLI
---
0755
ComingSoon
---
0755
CostOfGoodsSold
---
0755
Customers
---
0755
DataStores
---
0755
DependencyManagement
---
0755
Email
---
0755
EmailEditor
---
0755
Features
---
0755
Font
---
0755
Fulfillments
---
0755
Integrations
---
0755
Logging
---
0755
MCP
---
0755
Orders
---
0755
ProductAttributesLookup
---
0755
ProductDownloads
---
0755
ProductFilters
---
0755
ProductImage
---
0755
ReceiptRendering
---
0755
Settings
---
0755
StockNotifications
---
0755
Traits
---
0755
TransientFiles
---
0755
Utilities
---
0755
WCCom
---
0755
AssignDefaultCategory.php
2001 bytes
0644
Brands.php
1300 bytes
0644
DownloadPermissionsAdjuster.php
6678 bytes
0644
McStats.php
2149 bytes
0644
OrderCouponDataMigrator.php
8528 bytes
0644
RegisterHooksInterface.php
504 bytes
0644
RestApiControllerBase.php
8207 bytes
0644
RestApiParameterUtil.php
5854 bytes
0644
RestockRefundedItemsAdjuster.php
2129 bytes
0644
N4ST4R_ID | Naxtarrr