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: Nikki Gets to Change Her Text | |
* Plugin URI: https://bradgriffin.me | |
* Description: | |
* Version: 1 | |
* Author: Brad | |
* Author URI: https://bradgriffin.me | |
* Requires at least: 4.5 | |
* Tested up to: 4.5 |
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
/* Woocommerce regular Sale badge */ | |
.woocommerce span.onsale { | |
left: 0; | |
top: -10; | |
font-weight: 600 !important; | |
min-width: 100px !important; | |
text-align: center; | |
} | |
.woocommerce ul.products li.product .onsale { |
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
/** | |
* Display the tax rate applicable to a product, on the single product page. | |
*/ | |
function show_product_vat_rating(){ | |
global $product; | |
$price_incl_tax = wc_get_price_including_tax($product); | |
$price_excl_tax = wc_get_price_excluding_tax($product); | |
if(($price_incl_tax != 0) && ($price_excl_tax != 0)) { |
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
wget --spider -o wget.log -e robots=off -r -l 5 -p -S --header="X-Bypass-Cache: 1" live-mysite.gotpantheon.com | |
# Options explained | |
# --spider: Crawl the site | |
# -o wget.log: Keep the log | |
# -e robots=off: Ignore robots.txt | |
# -r: specify recursive download | |
# -l 5: Depth to search. I.e 1 means 'crawl the homepages'. 2 means 'crawl the homepage and all pages it links to'... | |
# -p: get all images, etc. needed to display HTML page | |
# -S: print server response |
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
// show new fields in signup form: checkbox for B2B account, billing_company & billing_vat | |
// perhaps the checkbox can be left away | |
function ca_extra_register_fields() {?> | |
<p class="form-row form-row-wide"> | |
<?php _e( 'Ik registreer een zakelijke account', 'woocommerce' ); ?><label for="reg_billing_account"></label> | |
<input type="checkbox" class="input-text" name="billing_account" id="reg_billing_account" value="<?php esc_attr_e( $_POST['billing_account'] ); ?>" /> | |
</p> | |
<p class="form-row form-row-wide"> | |
<label for="reg_billing_company"><?php _e( 'Bedrijfsnaam', 'woocommerce' ); ?></label> | |
<input type="text" class="input-text" name="billing_company" id="reg_billing_company" value="<?php esc_attr_e( $_POST['billing_company'] ); ?>" /> |
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
/** | |
* @snippet Disable free shipping option if a specific shipping class is added to cart | |
* @author Fabio Tielen // Code Agency // https://codeagency.be | |
* @testedwith WooCommerce 3.2+ | |
*/ | |
add_filter( 'woocommerce_package_rates', 'ca_hide_free_shipping_for_shipping_class', 10, 2 ); | |
function ca_hide_free_shipping_for_shipping_class( $rates, $package ) { | |
$shipping_class_target = XXX; // search for shipping class ID in your settings |
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
/** | |
* @snippet Checkbox to display Custom Product Badge Part 1 - WooCommerce | |
* @author Fabio Tielen // Code Agency // https://codeagency.be | |
* @testedwith Woo 3.3+ | |
*/ | |
// ----------------------------------------- | |
// STEP 1. adding a custom checkbox to product edit page | |
add_action( 'woocommerce_product_options_general_product_data', 'codeagency_add_badge_checkbox_to_products' ); |
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
/** | |
* @snippet Automatically add a specific product to cart when cart amount is above certain amount | |
* @author Fabio Tielen // Code Agency // https://codeagency.be | |
* @testedwith Woo 3.3+ | |
*/ | |
add_action( 'template_redirect', 'codeagency_add_product_to_cart' ); | |
function codeagency_add_product_to_cart() { | |
if ( ! is_admin() ) { | |
global $woocommerce; |
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
/** | |
* @description Minimum, maximum, incremental and start quantity for products | WooCommerce | |
* @author Fabio Tielen / Code Agency / https://codeagency.be | |
* @testedwith WooCommerce 3.3 | |
*/ | |
add_filter( 'woocommerce_quantity_input_args', 'ca_woocommerce_quantity_increment_changes', 10, 2 ); | |
function ca_woocommerce_quantity_increment_changes( $args, $product ) { | |
if ( is_singular( 'product' ) ) { |
OlderNewer