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
<?php | |
/** | |
* Plugin Name: WooCommerce Subscriptions Redirect to Checkout | |
* Description: Redirect customers to the checkout page when adding a subscription to their cart (rather than the checkout page, which is the default). | |
* Author: Simon Kelly | |
* Author URI: http://www.renegade-empire.com | |
* Version: 1.0 | |
* License: GPL v2 | |
*/ |
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
# Create .htaccess file within /wp-content/uploads/ and add the below code | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteCond %{HTTP_HOST} http://dev.example.com # Only perform on dev site | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule ^(.*) http://www.example.com/wp-content/uploads/$1 [L,P] | |
</IfModule> |
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
add_action('woocommerce_after_checkout_validation', 'deny_pobox_postcode'); | |
function deny_pobox_postcode( $posted ) { | |
global $woocommerce; | |
// Put postcode, address 1 and address 2 into an array | |
$check_address = array(); | |
$check_address[] = isset( $posted['shipping_postcode'] ) ? $posted['shipping_postcode'] : $posted['billing_postcode']; | |
$check_address[] = isset( $posted['shipping_address_1'] ) ? $posted['shipping_address_1'] : $posted['billing_address_1']; | |
$check_address[] = isset( $posted['shipping_address_2'] ) ? $posted['shipping_address_2'] : $posted['billing_address_2']; |
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
/* Add _subscription_start_date back to the viewable order meta data */ | |
add_filter( 'woocommerce_hidden_order_itemmeta', 'theme_hide_order_itemmeta' ); | |
function theme_hide_order_itemmeta( $hidden_meta_keys ) { | |
if ( ! defined( 'WCS_DEBUG' ) || true !== WCS_DEBUG ) { | |
if(($key = array_search('_subscription_start_date', $hidden_meta_keys)) !== false) { | |
unset($hidden_meta_keys[$key]); | |
} | |
} | |
return $hidden_meta_keys; | |
} |
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
/* ===================================================== | |
Custom profile field | |
===================================================== */ | |
function modify_contact_methods($profile_fields) { | |
// Add new fields | |
$profile_fields['company_name'] = 'Company Name'; | |
// Remove old fields | |
unset($profile_fields['aim']); |
NewerOlder