Advertisement
wpgenie

Add to cart button on shop / archive page for group buy

Jan 12th, 2022 (edited)
2,286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.37 KB | None | 0 0
  1. /* Add to cart button on shop / archive page for group buy */
  2.  
  3. function custom_woocommerce_loop_add_to_cart_args( $args, $product ){
  4.     if ( $product->get_type() == 'groupbuy' ) {
  5.         $args['class'] = $args['class'] . ' ajax_add_to_cart';
  6.     }
  7.     return $args;
  8. }
  9.  
  10. add_filter( 'woocommerce_loop_add_to_cart_args', 'custom_woocommerce_loop_add_to_cart_args', 10, 2 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement