JR84
Forum Replies Created
-
Forum: Plugins
In reply to: [WooCommerce] Next Day delivery for only certain productsThanks, Luke.
I have been playing around with this, but it doesn’t seem to work for me 🙁 I must be doing something wrong.
This is the code that I am using – I chose the one with the product tag as that gives me more flexibility. I gave one of my products the product tag ‘heavy’, but it doesn’t seem to do anything 🙁
/* !Hide Shipping Options Woocommerce */
add_filter( ‘woocommerce_available_shipping_methods’, ‘hide_shipping_based_on_tag’ , 10, 1 );
function check_cart_for_share() {
// load the contents of the cart into an array.
global $woocommerce;
$cart = $woocommerce->cart->cart_contents;$found = false;
// loop through the array looking for the tag you set. Switch to true if the tag is found.
foreach ($cart as $array_item) {
$term_list = wp_get_post_terms( $array_item[‘product_id’], ‘product_tag’, array( “fields” => “names” ) );if (in_array(“heavy”,$term_list)) { // Replace “Heavy” with what ever tag you want
$found = true;
break;
}
}return $found;
}
function hide_shipping_based_on_tag( $available_methods ) {
// use the function above to check the cart for the tag.
if ( check_cart_for_share() ) {// remove the rate you want
unset( $available_methods[‘booster_custom_shipping_1’] ); // Replace “flat_rate” with the shipping option that you want to remove.
}// return the available methods without the one you unset.
return $available_methods;}
Forum: Fixing WordPress
In reply to: Can’t login to my wp-adminIt is working again… Not sure what was going on there, but i can log in again and everything working fine…
Thanks
Forum: Fixing WordPress
In reply to: Can’t login to my wp-adminI also just noticed when you are on the actual site you can’t shop anymore. You can’t put anything in the basket? There is something terribly wrong here 🙁 Help!