Created
August 30, 2017 10:40
-
-
Save ibndawood/77eb8aa019b5a0ca49f72e796f89ec2c to your computer and use it in GitHub Desktop.
Electro - Catalog mode show variation in single product page
This file contains hidden or 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 electro_template_single_add_to_cart() { | |
global $product; | |
$product_type = electro_wc_get_product_type( $product ); | |
if( electro_get_shop_catalog_mode() == false ) { | |
do_action( 'woocommerce_' . $product_type . '_add_to_cart' ); | |
} elseif( electro_get_shop_catalog_mode() == true && $product->is_type( 'external' ) ) { | |
do_action( 'woocommerce_' . $product_type . '_add_to_cart' ); | |
} elseif( electro_get_shop_catalog_mode() == true && $product->is_type( 'variable' ) ) { | |
remove_action( 'woocommerce_single_variation', 'woocommerce_single_variation_add_to_cart_button', 20 ); | |
do_action( 'woocommerce_' . $product_type . '_add_to_cart' ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment