Skip to content

Instantly share code, notes, and snippets.

@media only screen and (max-width: 768px) {
.homepage-banner {
display: block;
}
}
@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 / 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 / stripe-icon-filter.php
Created January 11, 2018 23:40
To change the Stripe 4.0 icons back to colour.
add_filter( 'wc_stripe_payment_icons', 'change_my_icons' );
function change_my_icons( $icons ) {
// var_dump( $icons ); to show all possible icons to change.
$icons['visa'] = '<img src="https://mysite.com/wp-content/plugins/woocommerce/assets/images/icons/credit-cards/visa.svg" />';
return $icons;
}
@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;
}
@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' );
/**
* Function to remove the variable subscription price string
* Add this to your child theme's functions.php file.
*/
function wc_remove_var_subscriptions_price() {
return '';
}
add_filter( 'woocommerce_variable_subscription_price_html', 'wc_remove_var_subscriptions_price' );
@LaurenaRehbein
LaurenaRehbein / stripe-icon-edit.php
Created January 12, 2018 00:12
A sample of the edited function
add_filter( 'wc_stripe_payment_icons', 'change_my_icons' );
function change_my_icons( $icons ) {
// var_dump( $icons ); to show all possible icons to change.
$icons['visa'] = '<img src="http://woocommerce-ext.reh/wp-content/plugins/woocommerce/assets/images/icons/credit-cards/visa.svg" />';
$icons['mastercard'] = '<img src="http://woocommerce-ext.reh/wp-content/plugins/woocommerce/assets/images/icons/credit-cards/mastercard.svg" />';
$icons['amex'] = '<img src="http://woocommerce-ext.reh/wp-content/plugins/woocommerce/assets/images/icons/credit-cards/amex.svg" />';
return $icons;
}
@LaurenaRehbein
LaurenaRehbein / continue-shopping-redirect.php
Created February 28, 2019 20:08
Use this filter if you want customers to be redirected to a specific URL when they click "Continue Shopping"
<?php
// 'Continue Shopping' button re-direct
add_filter('woocommerce_continue_shopping_redirect', 'lar_wc_continue_shopping_redirect');
function lar_wc_continue_shopping_redirect( $redirect ) {
$redirect = 'http://yoururl.com/';
return $redirect;
}
@LaurenaRehbein
LaurenaRehbein / remove-payment-request-product-page.php
Created February 28, 2019 20:13
Use this to remove the Google Pay and Apple Pay buttons from the Single Product Pages, when using Stripe
<?php
add_filter( 'wc_stripe_hide_payment_request_on_product_page', 'lar_wc_stripe_hide_payment_request_on_product_page' );
function lar_wc_stripe_hide_payment_request_on_product_page() {
return true;
}