Advertisement
Guest User

add-to-cart.php

a guest
Sep 27th, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.19 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Loop Add to Cart
  4.  *
  5.  * This template can be overridden by copying it to yourtheme/woocommerce/loop/add-to-cart.php.
  6.  *
  7.  * HOWEVER, on occasion WooCommerce will need to update template files and you
  8.  * (the theme developer) will need to copy the new files to your theme to
  9.  * maintain compatibility. We try to do this as little as possible, but it does
  10.  * happen. When this occurs the version of the template file will be bumped and
  11.  * the readme will list any important changes.
  12.  *
  13.  * @see       https://docs.woothemes.com/document/template-structure/
  14.  * @author    WooThemes
  15.  * @package   WooCommerce/Templates
  16.  * @version     2.5.0
  17.  */
  18.  
  19.  
  20. if ( ! defined( 'ABSPATH' ) ) {
  21.   exit; // Exit if accessed directly
  22. }
  23.  
  24. global $product, $yith_wcwl;
  25. ?>
  26.  
  27. <div class="gg-product-meta">
  28.  
  29.   <?php
  30.   /**
  31.    * Enable/Disable Add to cart
  32.    */
  33.   if ( get_theme_mod('store_add_to_cart', 1) != 0 ) { ?>
  34.   <div class="add-to-cart-wrapper">
  35.   <?php
  36.   echo apply_filters( 'woocommerce_loop_add_to_cart_link',
  37.   sprintf( '<a href="%s" rel="nofollow" data-product_id="%s" data-product_sku="%s" data-quantity="%s" class="button %s product_type_%s">%s</a>',
  38.     esc_url( $product->add_to_cart_url() ),
  39.     esc_attr( $product->id ),
  40.     esc_attr( $product->get_sku() ),
  41.     esc_attr( isset( $quantity ) ? $quantity : 1 ),
  42.     $product->is_purchasable() && $product->is_in_stock() ? 'add_to_cart_button' : '',
  43.     esc_attr( $product->product_type ),
  44.     esc_html( $product->add_to_cart_text() )
  45.   ),
  46. $product );
  47.  
  48.   ?>
  49.   </div>
  50.   <?php } ?>
  51.  
  52.   <div class="extra-meta-wrapper">
  53.   <?php
  54.   if ( class_exists( 'YITH_WCWL_Init' ) ) {
  55.   if (get_theme_mod('store_add_to_wishlist', 1 ) == 1) {
  56.   ?>
  57.     <div class="add-to-wishlist-wrapper">
  58.       <?php echo GG_YITH::add_to_wishlist_button( $yith_wcwl->get_wishlist_url(), $product->product_type, $yith_wcwl->is_product_in_wishlist( $product->id ) ); ?>
  59.     </div>
  60.   <?php } } ?>
  61.  
  62.   <?php
  63.   if ( class_exists( 'YITH_Woocompare' ) ) {
  64.   if (get_theme_mod('store_add_to_compare', 1 ) == 1) {
  65.   ?>
  66.   <div class="compare-wrapper">
  67.     <?php echo do_shortcode('[yith_compare_button container="no"]'); ?>
  68.   </div>
  69.   <?php } } ?>
  70.  
  71.   </div>
  72.  
  73. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement