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
/** | |
* Remove the "Change Payment Method" button from the My Subscriptions table. | |
* | |
* This isn't actually necessary because @see eg_subscription_payment_method_cannot_be_changed() | |
* will prevent the button being displayed, however, it is included here as an example of how to | |
* remove just the button but allow the change payment method process. | |
*/ | |
function eg_remove_my_subscriptions_button( $actions, $subscription ) { | |
foreach ( $actions as $action_key => $action ) { |
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
/** | |
* Changes the county field to state/region to separate regions in the UK for brexit. | |
* This can be used to specify specific shipping zones for UK regions, like exluding Northern Ireland from UK shipping. | |
*/ | |
function custom_woocommerce_uk_states_brexit( $states ) { | |
$states['GB'] = array( | |
'ENG' => 'England', | |
'SCO' => 'Scotland', |
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
/** | |
* Sets all WooCommerce billing fields to be required. | |
*/ | |
function wc_require_billing_fields( $fields ) { | |
$fields['billing_first_name']['required'] = true; | |
$fields['billing_last_name']['required'] = true; | |
$fields['billing_company']['required'] = true; | |
$fields['billing_country']['required'] = true; | |
$fields['billing_address_1']['required'] = true; | |
$fields['billing_city']['required'] = true; |
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
/** | |
* Set failed orders to pending payment. | |
*/ | |
function wc_failed_to_pending( $order_id ){ | |
$order = new WC_Order( $order_id ); | |
$order->update_status( 'pending' ); | |
} | |
add_action( 'woocommerce_order_status_failed', 'wc_failed_to_pending'); |
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
function add_another_email_action( $array ) { | |
$array[]='woocommerce_order_status_processing_to_on-hold'; | |
return $array; | |
} | |
add_filter( 'woocommerce_email_actions', 'add_another_email_action' ); | |
function hook_another_email_on_hold( $email_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
[box icon="fa-wordpress" color="blue" url="https://wordpress.org"]Visit WordPress.org[/box] |
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
/** | |
* Adds wooslider into the storefront_before_content action in the parent themes header.php file. | |
*/ | |
function sd_storefront_homepage_slider() { | |
// if not the StoreFront Homepage Page Template return false | |
if ( ! is_page_template( 'template-homepage.php' ) ) { | |
return false; |
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
function sf_output_custom_text_section() { | |
echo '<section class="storefront-product-section storefront-product-category">'; | |
echo '<h2 class="section-title">' . __( 'Text Title', 'storefront' ) . '</h2>'; | |
echo '<p>This is some text blurb</p>'; | |
echo '</section>'; |
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
/** | |
* Sets all WooCommerce billing fields to be unrequired. | |
*/ | |
function wc_unrequire_billing_fields( $fields ) { | |
$fields['billing_first_name']['required'] = false; | |
$fields['billing_last_name']['required'] = false; | |
$fields['billing_company']['required'] = false; | |
$fields['billing_country']['required'] = false; | |
$fields['billing_address_1']['required'] = false; | |
$fields['billing_city']['required'] = false; |