WooCommerce – Clear default shipping and payment options on cart/checkout page.

By default, when a custo ignore the rest of the shipping options presented on cart page. Same scenario is applicable for payment options presented on checkout page. Screenshot - Default Shipping Option Code Snippet to clear the shipping and payment option while first time checkout. Below code snippet will help you tored as the default option for that session. So, while testing this snippet, use private / incognito the cart. Screenshot - No Default Shipping Option .button { border-radius: 5px; background-color: #5472D2; [...]

WooCommerce – Sort shipping options / methods / services by shipment cost

WooCommerce doesn't sort the shipping methods / services by default while showing it on cart and checkout page. Code Snippet for sorting the shipping options by cost. Below code snippet will help to sort the shipping options by shipping cost. Screenshot - Shipping Options - Default view. Screenshot - Shipping Options - Sorted view.   .button { border-radius: 5px; background-color: #5472D2; border: none; color: #FFFFFF; text-align: center; font-size: 35px; padding: 20px; width: 200px; transition: all 0.3s; [...]

WooCommerce – Add an additional fee based on State

Below code snippet will help to add an additional charge based on state. The example given is specific to the state Maharastra (India). This snippet will add an additional charge of amount 10 to the order if the specified state is chosen. Value of the variable $state and the text 'Additional Charge' could be changed as per your business case. Screenshot - Additional Charge on Checkout Page

Enable shipping state field for specific countries during WooCommerce Checkout

During WooCommerce checkout, there are number of countries (Afghanistan, Poland, etc ) for which state field does not show up while entering billing and shipping address. The complete list of states can be found by referring the function "load_country_states" from WooCommerce code class-wc-countries.php. Now, if you want to achieve this. Below code snippet will help you to solve this problem. Code Snippet to enable State for specific countries. Below code snippet will enable state for Afghanistan ('AF'). Change the code accordingly to so the [...]