Categories
WooCommerce

Cities Shipping Zones for WooCommerce

To config for a country shipping zones based on cities instead of states:

  • To add the country’s cities list with the plugin Cities Shipping Zones for WooCommerce
Categories
WordPress

WordPress Notifications Management

To add email address for receiving comments notifications:

add_filter( 'comment_moderation_recipients', 'condless_comment_moderation_recipients', 11, 2 );
add_filter( 'comment_notification_recipients', 'condless_comment_moderation_recipients', 11, 2 );
function condless_comment_moderation_recipients( $emails, $comment_id ) {
	array_push( $emails, "info@example.com" );
	return $emails;
}
Categories
WooCommerce

WooCommerce Custom Order Fields

To add to the orders custom fields which are vidisble only to admins:

add_action( 'woocommerce_checkout_create_order', 'condless_before_checkout_create_order', 20, 2 );
function condless_before_checkout_create_order( $order, $data ) {
	$order->update_meta_data( 'shipping_date', __( 'Empty Term.' ) );
	$order->update_meta_data( 'shipping_time', __( 'Empty Term.' ) );
}

add_action( 'woocommerce_admin_order_data_after_shipping_address', 'condless_checkout_field_display_admin_order_meta' );
function condless_checkout_field_display_admin_order_meta( $order ) {
	echo '<p><strong>'. __( 'Shipping', 'woocommerce' ) . ' ' . __( 'Date' ) . ':</strong> ' . get_post_meta( $order->get_id(), 'shipping_date', true ) . '</p>';
	echo '<p><strong>'. __( 'Shipping', 'woocommerce' ) . ' ' . __( 'Time' ) . ':</strong> ' . get_post_meta( $order->get_id(), 'shipping_time', true ) . '</p>';
}
Categories
WooCommerce

WooCommerce Product Category Page Customization

To display the product category description after the products instead of before:

add_action( 'woocommerce_archive_description', 'condless_custom_archive_description', 2 );
function condless_custom_archive_description() {
        if( is_product_category() ) {
                remove_action( 'woocommerce_archive_description', 'woocommerce_taxonomy_archive_description' );
                add_action( 'woocommerce_after_main_content', 'woocommerce_taxonomy_archive_description', 5 );
        }
}
Categories
WooCommerce

WooCommerce Variation Attributes Instead Select Options

To display select and the attributes instead of “options” in variable products:

add_filter( 'woocommerce_dropdown_variation_attribute_options_args', 'condless_filter_dropdown_variation_args' );
function condless_filter_dropdown_variation_args( $args ) {
        $args['show_option_none'] = __( 'Select', 'woocommerce' ) . ' ' . apply_filters( 'the_title', get_taxonomy( $args['attribute'] )->labels->singular_name );
        return $args;
}

add_filter( 'woocommerce_product_add_to_cart_text', 'condless_add_to_cart_text' );
function condless_add_to_cart_text( $text ) {
        global $product;
        if ( $product->is_type( 'variable' )  && $product->is_purchasable() ) {
                $text = __( 'Select', 'woocommerce' ) . ' ' . wc_attribute_label( array_key_first( $product->get_variation_attributes() ) );
        }
        return $text;
}
Categories
WooCommerce

Woocommerce Bulk Edit Products

To bulk edit variable products with the plugin.

Categories
WooCommerce

WooCommerce Discounts

To create advanced discounts with the plugin.

To create discount by payment method with the plugin.

To apply automatically coupons with the plugin.

To display the discount near the price in sale products:

add_filter( 'woocommerce_get_price_html', 'condless_simple_product_price_format', 10, 2 );
function condless_simple_product_price_format( $price, $product ) {
	if ( $product->is_on_sale() && $product->is_type('simple') ) {
		$price = 'was ' . wc_price ( $product->get_regular_price() ) . ' now ' . wc_price( $product->get_sale_price() ) . ' save ' . wc_price( $product->get_regular_price() - $product->get_sale_price() );      
	}
	return $price;
}
Categories
WooCommerce

WooCommerce Payment Methods

To add payment for apps which don’t have API with the plugin.

To add payment method by product with the plugin.

To add request for quote payment option with the plugin.

To set multi vendor with the plugin.

To config crowdfunding with the plugin.

To allow wholesale with the plugin.

Categories
WooCommerce

WooCommerce Custom Product Fields

To add custom fields with the plugin.

To create booking and appointments product with the plugin.

To add an inside info to a product:

To display the info via the Dashbaord- add attribute to the product and make it hidden in the store:

add_filter( 'woocommerce_product_get_attributes', 'condless_hide_attributes_from_additional_info_tabs', 20, 2 );
function condless_hide_attributes_from_additional_info_tabs( $attributes, $product ) {
	$hidden_attributes = [
		'pa_network',
		'pa_merchant',
		'pa_brand',
	];
	foreach ( $hidden_attributes as $hidden_attribute ) {
		if ( ! isset( $attributes[ $hidden_attribute ] ) ) {
			continue;
		}
		$attribute = $attributes[ $hidden_attribute ];
		$attribute->set_visible( false );
	}
	return $attributes;
}

To display the info in the Dashboard and after the purchase to the client as well- add to the product a purchase note, and if required add the note to the admin Email as well:

add_filter ('woocommerce_email_order_items_args', 'condless_send_purchase_note_to_everyone');
function condless_send_purchase_note_to_everyone( $args ) {
	$args['show_purchase_note']  = true;
	return $args;
}
Categories
WordPress

WordPress Multi Lingual

To set up WordPress Multisite (with sub-directories /sub-domains / local TLD’s) or with the plugin.