Skip to content

Instantly share code, notes, and snippets.

@PluginRepublicSupport
Last active March 13, 2023 12:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PluginRepublicSupport/e3512ad5af3187aa6f2c72bbc87fcf94 to your computer and use it in GitHub Desktop.
Save PluginRepublicSupport/e3512ad5af3187aa6f2c72bbc87fcf94 to your computer and use it in GitHub Desktop.
Add-ons on Rental Product Type
<?php
add_filter( 'pewc_filter_product_extra_groups', function( $product_extra_groups, $post_id) {
if ( is_cart() || is_checkout() ) {
return $product_extra_groups;
}
if( ! is_object( wc_get_product( $post_id ) ) ) {
return $product_extra_groups;
}
if ( ! wc_get_product( $post_id )->get_meta('_wcrp_rental_products_rental') == 'yes' ) {
$product_extra_groups = array();
}
return $product_extra_groups;
}, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment