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
/** | |
* Hide the price when shipping is free from third party shipping plugins | |
* Code snippets should be added to the functions.php file of your child theme | |
* (Updated for WooCommerce 3.5) | |
* | |
* @return string | |
*/ | |
add_filter( 'woocommerce_cart_shipping_method_full_label', function( $label, $method ) { | |
// only update for Free shipping methods | |
$has_cost = 0 < $method->cost; |
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
/** | |
* Hide all free shipping options when the given shipping option is available to choose | |
* Code snippets should be added to the functions.php file of your child theme | |
* | |
* @return array | |
*/ | |
function hide_shipping_when_option_is_available( $rates, $package ) { | |
// set the desired option | |
$shipping_op = 'betrs_shipping:10-2'; | |
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 ability to find and compare the longest length item in Table Rate shipping | |
* https://codecanyon.net/item/table-rate-shipping-for-woocommerce/3796656?ref=bolderelements | |
* | |
* Code should be added to theme's functions.php file | |
*/ | |
function betrs_add_longest_length_cond( $conditions ) { | |
// add new option to list | |
$conditions['longest_length'] = 'Longest Length'; | |
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 ability to find and compare the longest length item in Table Rate shipping | |
* https://codecanyon.net/item/table-rate-shipping-for-woocommerce/3796656?ref=bolderelements | |
* | |
* Code should be added to theme's functions.php file | |
*/ | |
function betrs_add_longest_length_cond( $conditions ) { | |
// add new option to list | |
$conditions['longest_length'] = 'Longest Length'; | |
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
/* | |
* Adds additional weight to cover packaging costs. | |
* | |
* Requires Table Rate Shipping 4.2+ | |
*/ | |
function betrs_add_packaging_weight( $calculated_totals, $items ){ | |
// weight to add | |
$add_weight = 350; // change this value to weight needed | |
// add weight to calculated totals |
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
/* | |
* Removes the title from a shipping option. | |
* Best to be used when only one shipping option is returned. | |
* | |
* Requires WooCommerce 2.1+ | |
*/ | |
function remove_title_from_shipping_label( $full_label, $method ){ | |
return str_replace( $method->get_label() . ': ', "", $full_label ); | |
} | |
add_filter( 'woocommerce_cart_shipping_method_full_label', 'remove_title_from_shipping_label', 10, 2 ); |
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
/* | |
* Adds the <img> tag to allowed tags in the Description field. | |
* | |
* Requires Table Rate Shipping for WooCommerce 4.2+ | |
*/ | |
add_filter( 'betrs_desc_allowed_tags', 'add_new_allowed_tags_betrs', 10, 1 ); | |
function add_new_allowed_tags_betrs( $allowedtags ) { | |
$allowedtags['img'] = array( | |
'alt' => true, |
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
/* | |
* Adds a $5 shipping surcharge to a specific shipping option. | |
* | |
* Requires WooCommerce 3.2+ | |
*/ | |
add_filter( 'woocommerce_package_rates', 'add_shipping_option_base_fee', 10, 2 ); | |
function add_shipping_option_base_fee( $rates, $package ) { | |
foreach( $rates as $key => $rate ) { | |
// configure surcharge settings |
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
/* | |
* Adds a $10 shipping surcharge for all items in the cart | |
* that are assigned to the 'bulky-items' shipping class. | |
* | |
* Requires WooCommerce 3.2+ | |
*/ | |
add_filter( 'woocommerce_package_rates', 'add_shipping_option_base_fee', 10, 2 ); | |
function add_shipping_option_base_fee( $rates, $package ) { | |
foreach( $rates as $key => $rate ) { |
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 bepawc_remove_product_subscriptions( $items ) { | |
unset( $items['product-subscriptions'] ); | |
return $items; | |
} | |
add_filter( 'woocommerce_account_menu_items', 'bepawc_remove_product_subscriptions', 999 ); | |
add_action( 'woocommerce_account_favorite-products_endpoint', array( $be_product_alerts->account->subscriptions, 'display_account_settings' ), 50 ); |