Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Set max limit based on product id.
- add_filter( 'dndmfu_wc_upload_max', function( $max, $product_id ) {
- // List of product ids and limit
- $product_ids = [121 => 10, 120 => 10, 103 => 12, 102 => 6, 101 => 4, 100 => 2];
- foreach( $product_ids as $id => $limit ) {
- if ( $product_id === $id ) {
- return $limit;
- }
- }
- return $max;
- }, 10, 2 );
- // Set min limit based on product id.
- add_filter( 'dndmfu_wc_upload_min', function( $min, $product_id ) {
- // List of product ids and limit
- $product_ids = [121 => 1, 120 => 1];
- foreach( $product_ids as $id => $minimum ) {
- if ( $product_id === $id ) {
- return $minimum;
- }
- }
- return $min;
- }, 10, 2 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement