Skip to content

Instantly share code, notes, and snippets.

View ncyhere's full-sized avatar
👋
Hello

ncyhere

👋
Hello
View GitHub Profile
@ncyhere
ncyhere / Woo-virtual-checkout.php
Created October 1, 2019 05:29
Woocommerce Remove Billing fields from checkout page if virtual/downloadable product is in cart
/**
* @snippet Simple Checkout for virtual Products
* @author NCY Design https://wordpress.ncy.design
* @compatible WooCommerce 3.7.0
*/
add_filter( 'woocommerce_checkout_fields' , 'ncydesign_virtualproduct_checkout' );
function ncydesign_virtualproduct_checkout( $fields ) {
@ncyhere
ncyhere / woo-conditionally-clear-cart.php
Created October 1, 2019 13:20
Remove conditionally Woocommerce cart items based on a specific product
// Remove conditionally cart items based on a specific product (item)
add_action( 'woocommerce_before_calculate_totals', 'remove_cart_items_conditionally', 10, 1 );
function remove_cart_items_conditionally( $cart ) {
// HERE define your specific product ID
$specific_product_id = 37;
if ( is_admin() && ! defined( 'DOING_AJAX' ) )
return;
$cart_items = $cart->get_cart(); // Cart items array
@ncyhere
ncyhere / woo-checkbox-hide-related-products.php
Created October 1, 2019 14:21
Disable related Products Per product With a checkbox
@ncyhere
ncyhere / woo-auto-complete-order.php
Created October 2, 2019 03:36
Auto Complete all WooCommerce orders.
/**
* Auto Complete all WooCommerce orders.
*/
add_action( 'woocommerce_thankyou', 'ncydesign_woocommerce_auto_complete_order' );
function ncydesign_woocommerce_auto_complete_order( $order_id ) {
if ( ! $order_id ) {
return;
}
$order = wc_get_order( $order_id );
@ncyhere
ncyhere / woo-rename-checkout-state.php
Created October 3, 2019 05:14
WooCommerce Rename “State” Label @ Checkout
/**
* @snippet Rename State Field Label @ WooCommerce Checkout
* @author NCY DESIGN https://wordpress.ncy.design
* @compatible WooCommerce 3.7
*/
add_filter( 'woocommerce_default_address_fields' , 'ncydesign_rename_state_province', 9999 );
function ncydesign_rename_state_province( $fields ) {
$fields['state']['label'] = 'Province';
@ncyhere
ncyhere / php.ini
Created October 3, 2019 06:15
Snippet for php.ini
memory_limit = 256M
post_max_size = 128M
upload_max_filesize = 32M
max_input_vars = 3000
max_execution_time = 300
@ncyhere
ncyhere / .htaccess
Created October 3, 2019 06:16
Snippets for .htaccess
php_value memory_limit 256M
php_value post_max_size 128M
php_value upload_max_filesize 32M
php_value max_input_vars 3000
php_value max_execution_time 300
@ncyhere
ncyhere / wp-config.php
Created October 3, 2019 06:18
Increase PHP Memory to 96M
define( 'WP_MEMORY_LIMIT', '96M' );
@ncyhere
ncyhere / wp-config.php
Created October 3, 2019 06:19
Php max memory limit
define( 'WP_MAX_MEMORY_LIMIT', '256M' );
@ncyhere
ncyhere / woo-remove-company-billing.php
Last active October 3, 2019 07:57
Remove Company Input Field from WooCommerce Checkout
/**
* @snippet Remove Company Input field from WooCommerce Checkout Page
* @author NCY DESIGN https://wordpress.ncy.design
* @compatible WooCommerce 3.7.0
*/
add_filter( 'woocommerce_checkout_fields' , 'ncydesign_remove_woocommerce_checkout_fields' );
function ncydesign_remove_woocommerce_checkout_fields( $fields ) {