Skip to content

[pull] master from mainwp:master #684

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## All in One SEO Pack code snippets

Tested version of WordPress 6.8.1, plugin version was All in One SEO Pack 4.8.1.1.
Tested version of WordPress 6.8.1, plugin version was All in One SEO Pack 4.8.2.

This file is a code snippet that is used for [All in One SEO Pack](https://wordpress.org/plugins/all-in-one-seo-pack/) plugin.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## WooCommerce Stripe Gateway code snippets

Tested version of WordPress 6.8, plugin version was WooCommerce Stripe Gateway 9.4.1.
Tested version of WordPress 6.8.1, plugin version was WooCommerce Stripe Gateway 9.5.0.

This file is a code snippet that is used for [WooCommerce Stripe Gateway](https://wordpress.org/plugins/woocommerce-gateway-stripe/) plugin.

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//Hide the Bundle When a product is Out of Stock
add_filter( 'woocommerce_product_is_visible', 'hide_bundle_when_required_product_is_out_of_stock', 10, 2 );

function hide_bundle_when_required_product_is_out_of_stock( $visible, $product_id ) {
$product = wc_get_product( $product_id );

// Check if the product is a bundle
if ( $product && $product->is_type( 'bundle' ) ) {
$bundled_items = $product->get_bundled_items();

// Loop through all bundled items
foreach ( $bundled_items as $bundled_item ) {
// Check if it's a required product
if ( ! $bundled_item->is_optional() ) {
$bundled_product = $bundled_item->get_product();

// If the required product is out of stock, hide the bundle
if ( $bundled_product && ! $bundled_product->is_in_stock() ) {
return false;
}
}
}
}

return $visible;
}