Skip to content

Instantly share code, notes, and snippets.

@LaurenaRehbein
LaurenaRehbein / redirect_to_shop.php
Last active March 19, 2019 17:12
To redirect to a specific page other than "shop".
/**
* // Custom redirect for users after clicking 'return to shop'
**/
add_filter('woocommerce_return_to_shop_redirect', 'lr_wc_return_to_shop_redirect');
function lr_wc_return_to_shop_redirect( $redirect ) {
$redirect = '/products/donation/';
return $redirect;
}
@LaurenaRehbein
LaurenaRehbein / custom_price_string.php
Created May 18, 2017 00:41
To change the wording on the Donations customization
function wtd_subscriptions_custom_price_string( $pricestring ) {
$newprice = str_replace( 'for 1 day', 'once', $pricestring );
return $newprice;
}
add_filter( 'woocommerce_subscriptions_product_price_string', 'wtd_subscriptions_custom_price_string' );
function lr_subscriptions_custom_price_string( $pricestring ) {
$newprice = str_replace( 'every day once', 'once', $pricestring );
return $newprice;
}
@LaurenaRehbein
LaurenaRehbein / remove_price.php
Last active January 12, 2018 19:38
To remove the Subscription Price
function wtd_remove_var_subscriptions_price() {
return '';
}
add_filter( 'woocommerce_variable_subscription_price_html', 'wtd_remove_var_subscriptions_price' );
@LaurenaRehbein
LaurenaRehbein / pipsupport
Created October 27, 2016 23:56
Add PIP support to Shipping Multiple Addresses
add_action( 'wc_pip_after_body', 'add_shipping_addresses_to_pip', 10, 4 );
function add_shipping_addresses_to_pip( $type, $action, $document, $order ) {
global $wcms;
if ( 'invoice' == $type ) {
$wcms->order->display_order_shipping_addresses($order);
}
}
@LaurenaRehbein
LaurenaRehbein / validate-settings.php
Created October 17, 2016 22:53
Validate your WooCommerce integration settings.
public function validate_api_key_field( $key, $value ) {
if ( isset( $value ) && 20 < strlen( $value ) ) {
WC_Admin_Settings::add_error( esc_html__( 'Looks like you made a mistake with the API Key field. Make sure it isn&apos;t longer than 20 characters', 'woocommerce-integration-demo' ) );
}
return $value;
}
@media only screen and (max-width: 768px) {
.homepage-banner {
display: block;
}
}