Product Icon

Advanced Shipping Packages for WooCommerce

Split your cart into separate packages, with dedicated shipping configurations.

Issue with plugin

I chose “New feature request”, because I do not see mine in support plugins dropdown (WooCommerce Advanced Shipping Packages).

I have a problem with this plugin. I was trying to configure it to create a package if in cart there is some backorder products. I managed to do that with help of stock parameter in “Shipping package condition”, so full configuration of this package looks like this:

If Stock less or equal to 0 – create package,
than exclude all unnecessary dispatch methods,
and put all products in cart besides some products with “Collection Only” shipping class.

With this configuration everything works like a charm besides one critical error. Sometimes it executes at basket, if not it will execute after making an order. The problem is when plugin executes match_condition_stock method of ASPWC_Match_Conditions class. Code fragment:

foreach ( $package[‘contents’] as $item ) :

/** @var $product WC_Product */
$product = $item[‘data’];
$stock[] = $product->get_stock_quantity();

endforeach;

// Get lowest value
$min_stock = min( $stock ); – error

$stock array seems to empty and when min() function is executed on empty array fatal error shows up.

Could you help me to fix that? 🙂

Kind Regards

Author

dawidt147

Current Status

Open

Last updated: January 31, 2023

0 comments

Log in to comment on this feature request.

Use of your personal data
We and our partners process your personal data (such as browsing data, IP Addresses, cookie information, and other unique identifiers) based on your consent and/or our legitimate interest to optimize our website, marketing activities, and your user experience.