Category Archives: woocommerce

Remove prices from WooCommerce

We can simple use a plugin for it. YITH WooCommerce Catalog Mode can do the work.

Although this might not be enough if you want to remove prices from Google results.

Add the following to your functions.php located at your theme page.

add_filter( 'woocommerce_structured_data_product_offer', '__return_empty_array' );

Test your page results according to Google at
https://search.google.com/test/rich-results?hl=pt-br

Google Support – About sale price annotations
https://support.google.com/merchants/answer/9017019?hl=en&sjid=11620160989609311719-EU

Google Merchant Center
https://www.google.com/retail/solutions/merchant-center/

woocommerce – only sell to specific cities



add_filter( 'woocommerce_form_field_args', 'custom_form_field_args', 10, 3 );
            function custom_form_field_args( $args, $key, $value ) { 
                if ( $args['id'] == 'billing_city' ) {
                 $args = array(
                        'label' => __( 'Town / City', 'woocommerce' ),
                        'required' => TRUE,
                        'clear' => TRUE,
                        'type' => 'select',
                        'options' =>  array(
                            '' => ('Select City' ),
                    'Bangalore' => ('Bangalore' ),
                    'Mysore' => ('Mysore' )
                    ),
                        'class' => array( 'update_totals_on_change' )
                    );
                } // elseif … and go on 

                return $args;
            };

And


function wc_sell_only_states( $states ) {
	$states['BR'] = array(
		'MG' => __( 'Minas Gerais', 'woocommerce' ),
	);

	return $states;
}
add_filter( 'woocommerce_states', 'wc_sell_only_states' );

As seen on