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 sd_regenerate_thumbnail_quality() { | |
// increase or decrease from 0 to 100 for a percentage of image quality. | |
return 100; | |
} | |
add_filter( 'jpeg_quality', 'sd_regenerate_thumbnail_quality'); |
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
/* Paypal cancel order redirect */ | |
add_filter( 'woocommerce_get_cancel_order_url_raw', 'paypal_canceled_redirect' ); | |
function paypal_canceled_redirect(){ | |
// Replace the URL below with the one you'd like to return to after a canceled order. | |
return "https://woocommerce.com"; | |
} |
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 is_valid_registration_email_domain( $username, $email, $validation_errors ){ | |
$valid_email_domains = array( 'gmail.com', 'yahoo.com' ); // Add allowed domains here | |
$valid = false; // sets default validation to false | |
foreach( $valid_email_domains as $d ){ | |
$d_length = strlen( $d ); | |
$current_email_domain = strtolower( substr( $email, -($d_length), $d_length)); | |
if( $current_email_domain == strtolower($d) ){ | |
$valid = true; | |
break; | |
} |
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
add_action( 'woocommerce_before_add_to_cart_button', 'sd_display_bulk_discount_table' ); | |
function sd_display_bulk_discount_table() { | |
global $woocommerce, $post, $product; | |
$array_rule_sets = get_post_meta( $post->ID, '_pricing_rules', true ); | |
if ( $array_rule_sets && is_array( $array_rule_sets ) && sizeof( $array_rule_sets ) > 0 ) { |
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 increase_sf_recent_products( $args ) { | |
// Sets the maximum products to 14 | |
$args['limit'] = 14; | |
// Output | |
return $args; | |
} | |
function remove_powerpack_filter() { |
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
add_filter('woocommerce_currency_symbol', 'change_existing_currency_symbol', 10, 2); | |
function change_existing_currency_symbol( $currency_symbol, $currency ) { | |
if ( ! is_checkout() ) { | |
return $currency_symbol; | |
} | |
switch( $currency ) { | |
case 'PKR': $currency_symbol = 'PKR'; break; |
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
/** | |
* Alters the output of the homepage product categories on the Storefront theme | |
* Affects the storefront_product_categories_args filter in /inc/storefront-template-functions.php | |
*/ | |
function sd_display_all_home_product_categories( $args ) { | |
// Sets the maximum product categories to 50, you can increase this to display more if need be. | |
$args['limit'] = 50; |
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 sd_display_four_home_product_categories( $args ) { | |
// Displays all product categoris on the homepage of Storefront | |
$args['limit'] = -1; | |
// Output | |
return $args; | |
} | |
add_filter( 'storefront_product_categories_args', 'sd_display_four_home_product_categories' ); |
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 custom_booking_product_price( $price, $product ) { | |
$target_product_types = array( | |
'booking' | |
); | |
if ( in_array ( $product->product_type, $target_product_types ) ) { | |
$price = str_replace("From:", "", $price); | |
return $price; | |
} | |
// return normal price | |
return $price; |
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 custom_override_billing_fields( $fields ) { | |
unset($fields['billing_email']); | |
return $fields; | |
} | |
add_filter( 'woocommerce_billing_fields' , 'custom_override_billing_fields' ); |