Skip to content

Instantly share code, notes, and snippets.

@MindyPostoff
MindyPostoff / gist:c70dc98a099a9bf1c2f0
Last active Jun 15, 2021
Reorder Display of Fields on WooCommerce Bookings Form
View gist:c70dc98a099a9bf1c2f0
/**
* A function to reorder the default display of fields on the WooCommerce Bookings form
* Put this function in your theme's functions.php file
*/
function custom_order_booking_fields ( $fields ) {
$reorder = array();
$reorder[] = $fields['wc_bookings_field_duration']; // Duration
$reorder[] = $fields['wc_bookings_field_resource']; // Resource
$reorder[] = $fields['wc_bookings_field_persons']; // Persons
@MindyPostoff
MindyPostoff / woocommerce-bookings-styles.css
Last active Apr 30, 2021
Bookings Datepicker Color Styles
View woocommerce-bookings-styles.css
/*
Modify the color styles of the WooCommerce Bookings datepicker calendar.
Add any/all of these styles to your theme's custom CSS, but be sure to change
the color hex codes to your choice. They're all black here.
*/
/* Month header background color */
#wc-bookings-booking-form .wc-bookings-date-picker .ui-datepicker-header {
background-color: #000000;
}
@MindyPostoff
MindyPostoff / order-notes-required.php
Last active Jul 31, 2020
Make the Order Notes field required in the WooCommerce Checkout
View order-notes-required.php
// Place this code in your theme's functions.php file
// Hook in
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
// Our hooked in function - $fields is passed via the filter!
function custom_override_checkout_fields( $fields ) {
$fields['order']['order_comments']['required'] = true;
return $fields;
}
@MindyPostoff
MindyPostoff / web.config
Created May 22, 2015
Windows Servers web.config for WooCommerce Endpoints
View web.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers accessPolicy="Read, Execute, Script" />
<rewrite>
<rules>
<rule name="wordpress" patternSyntax="Wildcard">
<match url="*" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
@MindyPostoff
MindyPostoff / remove-var-subs-price.php
Last active Feb 18, 2020
How to remove the price string from variable subscription products
View remove-var-subs-price.php
/**
* 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' );
@MindyPostoff
MindyPostoff / gist:a10148daa110119b262f
Last active Nov 14, 2019
Change "Proceed to PayPal" Text on Checkout Button in WooCommerce
View gist:a10148daa110119b262f
/* Change the "Proceed to PayPal" button text in the WooCommerce checkout screen
* Add this to your theme's functions.php file
*/
add_filter( 'gettext', 'custom_paypal_button_text', 20, 3 );
function custom_paypal_button_text( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Proceed to PayPal' :
$translated_text = __( 'NEW BUTTON TEXT', 'woocommerce' );
break;
}
@MindyPostoff
MindyPostoff / gist:00f623326db4daa50394
Created Jan 15, 2015
Custom URL for the Continue Shopping button in WooCommerce Cart
View gist:00f623326db4daa50394
/**
* Redirect the Continue Shopping URL from the default (most recent product) to
* a custom URL.
* Place this code snippet in your theme's functions.php file.
*/
function custom_continue_shopping_redirect_url ( $url ) {
$url = "http://www.woothemes.com"; // Add your link here
return $url;
}
add_filter('woocommerce_continue_shopping_redirect', 'custom_continue_shopping_redirect_url');
@MindyPostoff
MindyPostoff / gist:0add508ce8c8d9debf23
Last active Apr 23, 2018
Remove WooCommerce Subscriptions Billing Period from Shipping Price String in Cart
View gist:0add508ce8c8d9debf23
function wc_remove_recurrence_label() {
remove_filter( 'woocommerce_cart_shipping_method_full_label', 'WC_Subscriptions_Cart::get_cart_shipping_method_full_label', 11, 2 );
}
add_action( 'init', 'wc_remove_recurrence_label' );
View hide-free-price-woocommerce.php
add_filter( 'woocommerce_variable_free_price_html', 'hide_free_price_notice' );
add_filter( 'woocommerce_free_price_html', 'hide_free_price_notice' );
add_filter( 'woocommerce_variation_free_price_html', 'hide_free_price_notice' );
/**
* Hides the 'Free!' price notice
*/
function hide_free_price_notice( $price ) {
return '';
}
@MindyPostoff
MindyPostoff / gist:469fb7b59e8d028a21e2
Created Jan 16, 2015
Remove Renew button from the My Account page for customers with a cancelled subscription - WooCommerce Subscriptions
View gist:469fb7b59e8d028a21e2
/**
* This stops the renew button from appearing in the My Account page once an order's been cancelled
* @param array $actions List of actions that subscriptions can do with each subscription (on top of
* WooCommerce)
* @param array $subscriptions List of subscriptions' data belonging to the current user
* @return array List of action buttons that can happen with each subscription
*/
function remove_renew( $actions, $subscriptions ) {
foreach ( $actions as $key => $action ) {
if ( array_key_exists( 'renew', $action ) ) {