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
add_filter( 'woocommerce_instagram_images', 'woocommerce_instagram_img_count' ); | |
function woocommerce_instagram_img_count(){ | |
return 4; | |
} |
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
if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { | |
if ( ! function_exists( 'woocommerce_template_loop_add_to_cart' ) ) { | |
function woocommerce_template_loop_add_to_cart() { | |
global $product; | |
if ($product->get_type() == "variable" ) { | |
woocommerce_variable_add_to_cart(); | |
} |
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
add_filter( 'woocommerce_checkout_fields', 'filter_checkout_fields' ); | |
function filter_checkout_fields( $fields ) { | |
$fields['order']['order_comments']['maxlength'] = 140; | |
return $fields; | |
} |
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
add_filter( 'woocommerce_loop_add_to_cart_link', 'add_target_blank', 10, 2 ); | |
function add_target_blank( $link, $product ){ | |
if ( 'external' === $product->get_type() ) { | |
$link = sprintf( '<a href="%s" target="_blank" rel="nofollow" data-product_id="%s" data-product_sku="%s" data-quantity="%s" class="button product_type_%s">%s</a>', | |
esc_url( $product->add_to_cart_url() ), | |
esc_attr( $product->get_id() ), | |
esc_attr( $product->get_sku() ), |
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 custom_terms_and_conditions_link( $link ) { | |
// replace link below with your custom terms and conditions url | |
return 'https://google.com'; | |
} | |
add_filter( 'woocommerce_get_terms_page_permalink', 'custom_terms_and_conditions_link' ); | |
// This snippet can be used alongside https://gist.github.com/rynaldos/4993f8515580601856d51fccf974f8de (force terms and conditions to open in a new tab) |
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 disable_wc_terms_toggle() { | |
wp_enqueue_script( 'disable-terms-toggle', '/disable-terms-toggle.js', array( 'wc-checkout', 'jquery' ), null, true ); | |
wp_add_inline_script( 'disable-terms-toggle', "jQuery( document ).ready( function() { jQuery( document.body ).off( 'click', 'a.woocommerce-terms-and-conditions-link' ); } );" ); | |
} | |
add_action( 'wp_enqueue_scripts', 'disable_wc_terms_toggle', 1000 ); | |
// This snippet can be used alongside https://gist.github.com/rynaldos/0bee7d84a83c5b52096c747c19d088c0 (custom terms and conditions link) |
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
add_filter( 'woocommerce_dropdown_variation_attribute_options_args', 'wc_remove_options_text'); | |
function wc_remove_options_text( $args ){ | |
$args['show_option_none'] = ' '; | |
return $args; | |
} |
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
add_filter( 'woocommerce_checkout_fields' , 'woo_remove_billing_checkout_fields' ); | |
function woo_remove_billing_checkout_fields( $fields ) { | |
if( wc_cart_has_virtual_products() == true ) { | |
unset( $fields['billing']['billing_first_name'] ); | |
unset( $fields['billing']['billing_last_name'] ); | |
unset( $fields['billing']['billing_email'] ); | |
unset( $fields['billing']['billing_company']); |
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
add_filter( 'woocommerce_subcategory_count_html', 'wc_filter_woocommerce_subcat_count_html', 10, 2 ); | |
function wc_filter_woocommerce_subcat_count_html( $mark_class_count_category_count_mark, $category ) { | |
$mark_class_count_category_count_mark = ' <mark class="count">' . $category->count . '</mark>'; | |
return $mark_class_count_category_count_mark; | |
}; |
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
add_action('init','remove_loop_button'); | |
function remove_loop_button(){ | |
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 ); | |
} | |
add_action('woocommerce_after_shop_loop_item','replace_add_to_cart'); | |
function replace_add_to_cart() { | |
global $product; |