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 | |
add_action('woocommerce_cart_calculate_fees', 'apply_coupon_to_shipping', 10, 1); | |
function apply_coupon_to_shipping($cart) { | |
if (is_admin() && !defined('DOING_AJAX')) { | |
return; | |
} | |
// Get the applied coupon(s) |
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 | |
// Add new columns to the order table | |
add_filter('manage_edit-shop_order_columns', 'add_custom_order_column', 20); | |
function add_custom_order_column($columns) { | |
$columns['utm_source'] = __('Campaign', 'woocommerce'); | |
return $columns; | |
} | |
// Populate the new columns with UTM data |
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
define( 'WP_AUTO_UPDATE_CORE', false ); | |
define( 'DISALLOW_FILE_EDIT', true ); | |
define( 'WP_POST_REVISIONS', 12 ); | |
define('AUTOSAVE_INTERVAL', 180); |
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 | |
/** | |
* Email Order Items | |
* | |
* This template can be overridden by copying it to yourtheme/woocommerce/emails/email-order-items.php. | |
* | |
* HOWEVER, on occasion WooCommerce will need to update template files and you | |
* (the theme developer) will need to copy the new files to your theme to | |
* maintain compatibility. We try to do this as little as possible, but it does | |
* happen. When this occurs the version of the template file will be bumped and |
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 action_woocommerce_email_customer_details( $order, $sent_to_admin, $plain_text, $email ) { | |
if ( $email->id == 'customer_processing_order' && $order->has_shipping_method( 'local_pickup' ) ) { | |
echo __( '<strong>U ontvangt een mailtje wanneer uw bestelling klaarligt.</strong><br/><br+>', 'woocommerce' ); | |
// For 'completed' | |
} elseif( $email->id == 'customer_completed_order' && $order->has_shipping_method( 'local_pickup' ) ) { | |
echo __( '<strong>Uw bestelling ligt klaar. <a href="https://www.vanlommelprinting.be/contact/">Bekijk onze openingsuren</a></strong><br/><br/>', 'woocommerce' ); | |
} | |
} | |
add_action( 'woocommerce_email_before_order_table', 'action_woocommerce_email_customer_details', 10, 4 ); |
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( 'template_redirect', function() { | |
remove_action( 'wp_enqueue_scripts', 'wp_enqueue_global_styles' ); | |
remove_action( 'wp_footer', 'wp_enqueue_global_styles', 1 ); | |
}); |
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 | |
// define the woocommerce_structured_data_product callback | |
function filter_woocommerce_structured_data_product( $markup, $product ) { | |
$formaat = get_field("boek_formaat"); | |
$authors = get_field("boek_auteurs"); | |
$date = get_the_date('Y m d'); | |
$markup['additionalType'] = "book"; | |
$markup['brand'] = "Ertsberg"; | |
$markup['isbn'] = $product->get_sku(); |
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
// Account Edit Adresses: Remove and reorder addresses fields | |
add_filter( 'woocommerce_default_address_fields', 'custom_default_address_fields', 20, 1 ); | |
function custom_default_address_fields( $fields ) { | |
if( ! is_account_page() ) return $fields; | |
$sorted_fields = array('first_name','last_name','country','address_1','postcode','city'); | |
$new_fields = array(); | |
$priority = 0; | |
foreach($sorted_fields as $key_field){ | |
$priority += 10; | |
if( $key_field == 'postcode' ) |
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
// Check if address field contains house number otherwise provide error message | |
add_action( 'woocommerce_after_checkout_validation', 'validate_checkout', 10, 2); | |
function validate_checkout( $data, $errors ){ | |
if ( ! preg_match('/[0-9]/', $data[ 'billing_address_1' ] ) ){ | |
$errors->add( 'address', 'Het adresveld bevat geen huisnummer of busnummer.' ); | |
} | |
} |
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 WooCommerce Checkbox checkout | |
*/ | |
add_action( 'woocommerce_review_order_before_submit', 'woofers_add_checkout_checkbox', 10 ); | |
function woofers_add_checkout_checkbox() { | |
woocommerce_form_field( 'checkout-checkbox', array( // CSS ID | |
'type' => 'checkbox', | |
'class' => array('form-row mycheckbox'), // CSS Class | |
'label_class' => array('woocommerce-form__label woocommerce-form__label-for-checkbox checkbox'), |
NewerOlder