Skip to content

Instantly share code, notes, and snippets.

@shreyans94
shreyans94 / gist:dad92a9d587a883a32efd998bb594f0b
Created January 23, 2018 21:41
Edit Woocommerce/Wordpress Password Strength and its Text (From strength 3 to 1)
function wc_ninja_remove_password_strength() {
if ( wp_script_is( 'wc-password-strength-meter', 'enqueued' ) ) {
wp_dequeue_script( 'wc-password-strength-meter' );
}
}
add_action( 'wp_print_scripts', 'wc_ninja_remove_password_strength', 100 );
add_filter( 'woocommerce_min_password_strength', create_function( '', 'return 1;' ) );
add_action( 'wp_enqueue_scripts', 'my_strength_meter_localize_script' );
@shreyans94
shreyans94 / gist:74549e9b9c5bd3f293d5dc246c28f524
Created January 23, 2018 21:41
Change Woocommerce Out of Stock Text
add_filter( 'woocommerce_get_availability', 'wcs_custom_get_availability', 1, 2);
function wcs_custom_get_availability( $availability, $_product ) {
// Change Out of Stock Text
if ( ! $_product->is_in_stock() ) {
$availability['availability'] = __('<b>SOLD OUT!</b><BR><BR>
<font color=#007a00;> </font>', 'woocommerce');
}
return $availability;
@shreyans94
shreyans94 / gist:291e722dc055c5b84abab2eef7e87fc2
Created January 23, 2018 21:40
remove coupon field on woocommerce cart page
// hide coupon field on cart page.
function hide_coupon_field_on_cart( $enabled ) {
if ( is_cart() ) {
$enabled = false;
}
return $enabled;
}
add_filter( 'woocommerce_coupons_enabled', 'hide_coupon_field_on_cart' );
@shreyans94
shreyans94 / gist:7fbd541c7298908304fbea4a14de92fd
Created January 23, 2018 21:39
Add Sale Badge On Product Page (WooThumbs Comaptibility)
add_action('woocommerce_before_single_product_summary','flatsome_sale_flash_custom',21);
function flatsome_sale_flash_custom(){
do_action('flatsome_sale_flash');
}
@shreyans94
shreyans94 / gist:39b688682fc9b164d2ab3911688b2e21
Created January 23, 2018 21:39
Move Woocommerce Short Description Below Add to Cart in Product Page
//* change product excerpt and add to cart order in the single product page *//
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 20 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 50 );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 20 );
@shreyans94
shreyans94 / gist:7e8da767176feb1dda5966c8f0dcb79f
Created January 23, 2018 21:38
WooCommerce Variations Ajax Fix
function iconic_wc_ajax_variation_threshold( $qty, $product ) {
return 50;
}
add_filter( 'woocommerce_ajax_variation_threshold', 'iconic_wc_ajax_variation_threshold', 10, 2 );
@shreyans94
shreyans94 / gist:a36f46b06af060cb95ce12e4d3d8d715
Created January 23, 2018 21:38
Change subject in woocommerce new order email
/**
* @snippet Add Billing First_name to Email Receipt
* @how-to Watch tutorial @ https://businessbloomer.com/?p=19055
* @sourcecode https://businessbloomer.com/?p=19870
* @author Rodolfo Melogli
* @testedwith WooCommerce 2.5.2
*/
add_filter('woocommerce_email_subject_customer_processing_order', 'bbloomer_change_processing_email_subject', 10, 2);
@shreyans94
shreyans94 / gist:0a2a2f96968dc65ba43aa9647c4e7d5f
Created January 23, 2018 21:37
Add scroll feature in Guaven Woo Search Box Plugin
function custom_guaven_js(){
?>
<script>
jQuery(window).scroll(function(){
var guaven_woos_offset = jQuery('.header-search-form-wrapper [name="s"]').offset();
jQuery(".guaven_woos_suggestion").css('left', guaven_woos_offset.left);
jQuery(".guaven_woos_suggestion").css('top', guaven_woos_offset.top + parseFloat(jQuery('.header-search-form-wrapper [name="s"]').outerHeight()));
});
</script>
<?php
@shreyans94
shreyans94 / Remove woocommerce print invoice and packing slip plugin invoice link from emails.txt
Last active January 29, 2018 14:16
Remove woocommerce print invoice and packing slip plugin invoice link from emails
@shreyans94
shreyans94 / gist:2c5c927573f6f16a41298e684ff6013d
Created January 23, 2018 21:36
Allow editing of woocommerce orders under status of Processing
add_filter( 'wc_order_is_editable', 'wc_make_processing_orders_editable', 10, 2 );
function wc_make_processing_orders_editable( $is_editable, $order ) {
if ( $order->get_status() == 'processing' ) {
$is_editable = true;
}
return $is_editable;
}