Guest User

Untitled

a guest
Jan 19th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. <?php
  2. if ( ! function_exists( 'woocommerce_template_loop_add_to_cart' ) ) {
  3.  
  4. /**
  5. * Get the add to cart template for the loop.
  6. *
  7. * @subpackage Loop
  8. */
  9. function woocommerce_template_loop_add_to_cart( $args = array() ) {
  10. global $product;
  11.  
  12. if ( $product ) {
  13. $defaults = array(
  14. 'quantity' => 1,
  15. 'class' => implode( ' ', array_filter( array(
  16. 'button',
  17. 'product_type_' . $product->product_type,
  18. $product->is_purchasable() && $product->is_in_stock() ? 'add_to_cart_button' : '',
  19. $product->supports( 'ajax_add_to_cart' ) ? 'ajax_add_to_cart' : ''
  20. ) ) )
  21. );
  22.  
  23. $args = apply_filters( 'woocommerce_loop_add_to_cart_args', wp_parse_args( $args, $defaults ), $product );
  24.  
  25. wc_get_template( 'loop/add-to-cart.php', $args );
  26. }
  27. }
  28. }
  29. ?>
Add Comment
Please, Sign In to add comment