Product Bundles 7.0.0, Composite Products 9.0.0 and All Products for Woo Subscriptions 5.0.0 will be released on March 5th, 2024. These updates make all three extensions compatible with PHP 8.3, but include a change in how product properties are handled that third-party developers should be aware of.
Release Notes
Introducing PHP 8.3 Compatibility
These new versions make Product Bundles, Composite Products and All Products for Woo Subscriptions compatible with PHP 8.3 by:
- resolving all PHP 8.3 notices,
- properly declaring class properties that were previously not declared and;
- using the new controller to handle (set, get, delete) properties on WooCommerce Core objects that were previously dynamically declared. You can learn more about this change below.
For Product Bundles, the new controller is: WC_PB_Product_Data
.
For Composite Products, the new controller is: WC_CP_Product_Data
.
For All Products for Woo Subscriptions, the new controller is: WCS_ATT_Product_Data
.
Impact
Update Requirement
If youโre a merchant who uses Product Bundles, Composite Products and All Products for Woo Subscriptions together, all must be updated for full compatibility. For example, if you update Composite Products to 9.0.0, you must also update Product Bundles to 7.0.0 (and vice-versa). Only updating one of the three extensions may result in unexpected behavior due to incompatibility.
Additionally, to continue using Product Add-Ons with Product Bundles 7.0.0, Composite Products 9.0.0 or All Products for Woo Subscriptions 5.0.0 you must update Product Add-Ons to v6.7.0.
Extension Developers: Supporting these Updates
The way in which developers should interact with properties has changed in these updates. You should make use of the new product data controllers depending on the plugin you are integrating with.
Hereโs how you could use the controller to get, set and delete the composited_weight
property using the Composite Products product data controller as an example:
- Getting a property:
WC_CP()->product_data->get( $product, 'composited_weight' );
- Setting a property:
WC_CP()->product_data->set( $product, 'composited_weight', $value );
- Unsetting a property:
WC_CP()->product_data->delete( $product, 'composited_weight' );
In these examples, $product
is the object that holds or will be associated with the property, and $value
is the propertyโs value.
When updating your extension to add compatibility for this update, hereโs what some of the changes may look like (the following example uses a Product Bundles property and a Product Bundles data controller):
- Getting a property:
$value = $product->bundled_item_price;
would becomeWC_PB()->product_data->get( $product, 'bundled_item_price' );
- Setting a property:
$product->bundled_item_price = $value;
would becomeWC_PB()->product_data->set( $product, 'bundled_item_price', $value );
- Unsetting a property:
unset( $product->bundled_item_price);
would becomeWC_PB()->product_data->delete( $product, 'bundled_item_price' );
The properties that were previously dynamically declared and therefore should make use of this controller are:
- In Composite Products:
composited_weight
,composited_value
,child_subtotals_added
,composite_needs_processing
,composited_cart_item
,is_filtered_price_html
,composited_price_offset
,composited_price_offset_pct
,wc_mmq_composited_item
,container_quantity
.
- In Product Bundles:
bundled_cart_item
,block_subscription
,bundled_weight
,bundled_value
,child_subtotals_added
,bundle_needs_processing
,bundled_price_offset
,bundled_price_offset_pct
,bundled_item_price
,wc_mmq_bundled_item
,container_quantity
.
- In All Products for Woo Subscriptions:
wcsatt_instance
,wcsatt_bypass_switch_filter
.
If youโre unable to make these changes, we recommend throwing a compatibility notice that your extension isnโt compatible with Product Bundles 7.0.0, Composite Products 9.0.0 or All Products for Woo Subscriptions 5.0.0.
Thank you!
Thanks for building on Woo! We appreciate you!
If you have any questions or feedback about these updates, we recommend joining our community Slack and sharing them there. If you run into any issues with these updates, please report them through your Woo.com account and create a ticket and select the product from the product dropdown on that page.
Leave a Reply