Advertisement
CodeDropz

Change Max Limit on Specific Category - Drag & Drop Upload WooCommerce

Nov 6th, 2023
1,145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.54 KB | None | 0 0
  1. add_action('wp_head', function(){
  2.     ?>
  3.         <script>
  4.             jQuery(document).ready(function($) {
  5.                 const categories = ['accessories','decor'];
  6.                 const limit = 10;
  7.                 $.each( categories, function( index, cat ) {
  8.                     if( $('body').hasClass( 'product_cat-' + cat.toLowerCase() ) ){
  9.                         $( '.wc-drag-n-drop-file').attr('data-max', limit );
  10.                     }
  11.                 });
  12.                
  13.             });
  14.         </script>
  15.     <?php
  16.     });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement