Add a new country to countries list

with Sem comentários

To add a new country to the countries list, use this snippet (you can paste it in the functions.php file within our theme folder): /* Add a new country to countries list */ function woo_add_my_country( $country ) { $country[“AE-DU”] = ‘Dubai’; return $country; } add_filter( ‘woocommerce_countries’, ‘woo_add_my_country’, 10, 1 );

Automatically Complete Orders

with Sem comentários

Sometimes I like it when the cart automatically completes the orders. To achieve this auto completion I use the following block of code /** * Auto Complete all WooCommerce orders. * Add to theme functions.php file */ add_action( ‘woocommerce_thankyou’, ‘custom_woocommerce_auto_complete_order’ ); function custom_woocommerce_auto_complete_order( $order_id ) { global $woocommerce; if ( … Ler mais

Adjust the quantity input values

with Sem comentários

Add the following snippet to your themes functions.php file to adjust the quantity inputs behavior. Set the starting value, maximum value, minimum value and increment amount. // Simple products add_filter( ‘woocommerce_quantity_input_args’, ‘jk_woocommerce_quantity_input_args’, 10, 2 ); function jk_woocommerce_quantity_input_args( $args, $product ) { $args[‘input_value’] = 2; // Starting value $args[‘max_value’] = 80; … Ler mais

Change add to cart button text

with Sem comentários

Customizing cart button allows you to display text in your preferred text. You can add the following to your functions.php file to change add to cart button text. //Single Page add_filter( ‘woocommerce_product_single_add_to_cart_text’, ‘woo_custom_cart_button_text’ ); // 2.1 + function woo_custom_cart_button_text() { return __( ‘My Button Text’, ‘woocommerce’ ); }   //On … Ler mais

Woocommerce – Order by price, date or title on shop page

with Sem comentários

Ordering product by price, date and title is a good way to help customers sort out the products in your site. The following snippet helps you to order the products by price, date or the title. add_filter(‘woocommerce_default_catalog_orderby’, ‘custom_default_catalog_orderby’); function custom_default_catalog_orderby() { return ‘date’; // Can also use title and price … Ler mais

Woocommerce – Redireciona para o checkout depois de adicionar ao carrinho

with Sem comentários

Redirect to checkout page after add to cart To improve the sales conversions , automatically redirecting to checkout page after adding product to cart is a cool move. To auto redirect customers to checkout when they add products to cart, use the following code: function add_to_cart_checkout_redirect() { wp_safe_redirect( get_permalink( get_option( … Ler mais