Last active
August 29, 2015 14:14
-
-
Save ibndawood/d1b6e5ea50ddb7d7c5d5 to your computer and use it in GitHub Desktop.
Add to Cart button for Catalog Mode : MediaCenter Wordpress Theme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function catalog_mode_add_to_cart_link( $link, $product ){ | |
global $media_center_theme_options, $woocommerce_loop; | |
$product_item_size = isset( $woocommerce_loop['product_item_size'] ) ? $woocommerce_loop['product_item_size'] : $media_center_theme_options['product_item_size']; | |
$btn_classes = 'le-button'; | |
$btn_classes .= ( $product_item_size == 'size-big' ) ? 'big' : ''; | |
if ( ( isset( $media_center_theme_options['catalog_mode'] ) ) && ( $media_center_theme_options['catalog_mode'] == 1 ) ) { | |
$link = '<div class="add-cart-button"><a href="'. $product->get_permalink() . '" rel="nofollow" class="' . $btn_classes . '">View Product</a></div>'; | |
} | |
return $link; | |
} | |
add_filter( 'woocommerce_loop_add_to_cart_link', 'catalog_mode_add_to_cart_link', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment