arianasu
Forum Replies Created
-
Forum: Plugins
In reply to: [WooCommerce] How to make free shipping the only option after a set amount?Its ok I found out how to do it. For other newbies…once you have made your child theme create a folder within that using your text editor named functions.php and add the code below with <?php at top line. (I dont know if you need to add the extra parts above and below the code every time you add a new function or if the functions always get added within the existing ones as this is the first function i have added to my child theme).
<?php
/* custom PHP functions below this line */
// Hide standard shipping option when free shipping is available
add_filter( ‘woocommerce_available_shipping_methods’, ‘hide_standard_shipping_when_free_is_available’ , 10, 1 );/**
* Hide Standard Shipping option when free shipping is available
*
* @param array $available_methods
*/
function hide_standard_shipping_when_free_is_available( $available_methods ) {if( isset( $available_methods[‘free_shipping’] ) AND isset( $available_methods[‘flat_rate’] ) ) {
// remove standard shipping option
unset( $available_methods[‘flat_rate’] );
}return $available_methods;
}
?>Forum: Plugins
In reply to: [WooCommerce] How to make free shipping the only option after a set amount?@bridiemelia. How do I put it in my child theme functions.php? I know how to get into my functions.php folder in my child theme but i dont know if i am ment to keep the parent themes coding and just paste it underneith or do i delete all that and then paste it in or do i need to add something extra. Ive tried so many ways and none are working. It worked before when i just pasted it underneath in the parent themes functions.php but my site crashed when i added another code a few days later so i made my child one and don’t want to risk it again. Please help…Thanks 🙂