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_shipping_free_shipping_is_available', 'prefix_is_available_up_to_max_amount', 10, 3 ); | |
/** | |
* @param bool $is_available | |
* @param array $package Shipping package. | |
* @param WC_Shipping_Free_Shipping $shipping_class | |
* @return bool | |
*/ | |
function prefix_is_available_up_to_max_amount( $is_available, $package, $shipping_class ) { | |
$max_amount = 200; | |
$total = WC()->cart->get_displayed_subtotal(); |
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
.product .woocommerce-tabs ul.tabs { | |
width: 100%; | |
float: none; | |
margin-right: 5.8823529412%; | |
} | |
.woocommerce div.product .woocommerce-tabs ul.tabs { | |
list-style: none; | |
padding: 0 0 0 1em; | |
margin: 0 0 1.618em; |
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_shipping_free_shipping_is_available', 'prefix_is_available_for_certain_products', 10, 3 ); | |
/** | |
* @param bool $is_available | |
* @param array $package Shipping package. | |
* @param WC_Shipping_Free_Shipping $shipping_class | |
* | |
* @return bool | |
*/ | |
function prefix_is_available_for_certain_products( $is_available, $package, $shipping_class ) { |
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_email_recipient_customer_processing_order', 'prefix_add_recipients_to_processing_order_email', 10, 2 ); | |
/** | |
* @param string $recipient The recipient email, usually the billing address email | |
* @param WC_Order $order | |
* | |
* @return string | |
*/ | |
function prefix_add_recipients_to_processing_order_email( $recipient, $order ) { | |
// Add as many emails to the recipient as you want by separating them with "," |
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_show_admin_notice', 'prefix_show_updated_notice', 10, 2 ); | |
function prefix_show_updated_notice( $show, $notice ) { | |
// Check for the notice you want to hide | |
// Refer to the WC_Admin_Notices::$code_notices (array keys) for the values | |
// Update notice? | |
if ( 'update' != $notice ) { | |
return $show; | |
} | |
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_login_credentials', 'prefix_check_admin_login' ); | |
function prefix_check_admin_login( $credentials ) { | |
if ( is_email( $credentials['user_login'] ) ) { | |
$user = get_user_by( 'email', $credentials['user_login'] ); | |
} else { | |
$user = get_user_by( 'login', $credentials['user_login'] ); | |
} | |
// If the user is administrator or has any rights that you want | |
if ( user_can( $user, 'administrator' ) ) { |
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
// Filters both variations and simple products with the same function | |
add_filter( 'woocommerce_product_variation_get_weight', 'filter_product_weight', 10, 2 ); | |
add_filter( 'woocommerce_product_get_weight', 'filter_product_weight', 10, 2 ); | |
/** | |
* @param float $weight | |
* @param WC_Product $product | |
* | |
* @return int | |
*/ | |
function filter_product_weight( $weight, $product ) { |
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( 'wc_paytrace_transaction_request', 'prefix_filter_paytrace_transaction_request', 10, 5 ); | |
/** | |
* @param array $request_parameters | |
* @param WC_Order $order The order to be charged | |
* @param float $amount Amount to be charged | |
* @param bool $is_subscription Is this a subscription | |
* @param bool $is_paid_with_profile Is this a profile payment(true) or new card is used(false) | |
* | |
* @return array | |
*/ |
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( 'wc_paytrace_transaction_request', 'prefix_filter_paytrace_transaction_request', 10, 5 ); | |
/** | |
* @param array $request_parameters | |
* @param WC_Order $order The order to be charged | |
* @param float $amount Amount to be charged | |
* @param bool $is_subscription Is this a subscription | |
* @param bool $is_paid_with_profile Is this a profile payment(true) or new card is used(false) | |
* | |
* @return array | |
*/ |
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_payment_complete_order_status', 'prefix_filter_wc_complete_order_status', 10, 3 ); | |
/** | |
* @param string $status | |
* @param int $order_id | |
* @param WC_Order $order | |
* | |
* @return string | |
*/ | |
function prefix_filter_wc_complete_order_status( $status, $order_id, $order ) { | |
return 'on-hold'; |