Skip to content

Instantly share code, notes, and snippets.

View imran-khan1's full-sized avatar

Imran Khan imran-khan1

  • WordPress Developer
  • Pakistan
View GitHub Profile
<?php
//remove flatsome woocommerce shop page product category
remove_action('woocommerce_shop_loop_item_title','flatsome_woocommerce_shop_loop_category', 0);
<?php
/*
* remove checkout field in Woocommerce
*/
add_filter( 'woocommerce_checkout_fields' , 'ci_woo_checkout_fields' );
function ci_woo_checkout_fields( $fields ) {
unset($fields['billing']['billing_first_name']); // remove the customer's First Name for billing
<?php
/*
*remove Order Notes from checkout field in Woocommerce
*/
add_filter( 'woocommerce_checkout_fields' , 'ci_woo_checkout_fields' );
function ci_woo_checkout_fields( $fields ) {
unset($fields['order']['order_comments']);
return $fields;
}
<?php
/*
* Remove some checkout billing fields
*/
function ci_woo_billing_fields($fields){
unset( $fields["billing_country"] );
unset( $fields["billing_company"] );
unset( $fields["billing_address_1"] );
unset( $fields["billing_address_2"] );
<?php
/*
* Reorder WooCommerce Checkout Fields
*/
function ci_woo_reorder_fields($fields) {
$fields['billing']['billing_first_name']['priority'] = 10;
$fields['billing']['billing_last_name']['priority'] = 20;
$fields['billing']['billing_email']['priority'] = 30;
$fields['billing']['billing_phone']['priority'] = 40;
<?php
/*
*Add WooCommerce checkout Custom shipping field
*/
add_filter( 'woocommerce_checkout_fields' , 'ci_custom_override_checkout_fields' );
// Our hooked in function - $fields is passed via the filter!
function ci_custom_override_checkout_fields( $fields ) {
$fields['shipping']['shipping_fax'] = array(
<?php
/**
* Insert the new endpoint into the My Account menu.
*
* @param array $items
* @return array
*/
function ci_custom_account_menu_items( $items ) {
// Remove the logout menu item.
$logout = $items['customer-logout'];
<?php
/*
* Notification on order processing to cancelled status change
*/
function ci_cancelled_notification( $order_id ) {
$order = wc_get_order( $order_id );
// load the mailer class
<?php
/*
update cart on quantity field value change
*/
add_action( 'wp_footer', 'wc_qty_change_update_cart' );
function wc_qty_change_update_cart() {
if (is_cart()) :
?>
<?php
/*
update checkout on billing postcode field blur
*/
function wc_field_blur_update_checkout(){?>
<script>
jQuery("#billing_postcode").blur(function(){
jQuery( 'body' ).trigger( 'update_checkout' );