Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if ($_SESSION["sample_count"] == $_SESSION["cart_items_count"]){
- $sample_count = $_SESSION["sample_count"];
- $sample_shipping_cost = 4;
- $woocommerce->cart->add_fee( 'Samples Postage', ($sample_count * 4), true, '' );
- set_cart_contents_weight(0);
- }
- <td data-title="Transport Costs">
- <ul id="shipping_method">
- <li>
- <input type="radio" name="shipping_method[0]" data-index="0" id="shipping_method_0_wbs10065ab3a2_delivery" value="wbs:10:065ab3a2_delivery" class="shipping_method" checked='checked' />
- <label for="shipping_method_0_wbs10065ab3a2_delivery">Delivery: <span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">$</span>6.28</span></label>
- </li>
- <li>
- <input type="radio" name="shipping_method[0]" data-index="0" id="shipping_method_0_local_pickup16" value="local_pickup:16" class="shipping_method" />
- <label for="shipping_method_0_local_pickup16">Local pickup</label>
- </li>
- </ul>
- add_filter( 'woocommerce_cart_needs_shipping', 'show_hide_shipping_methods' );
- function show_hide_shipping_methods( $needs_shipping ) {
- $cart_items_total = WC()->cart->get_cart_contents_total();
- if ( $cart_items_total < 40 ) {
- $needs_shipping = false;
- // Optional: Enable shipping address form
- add_filter('woocommerce_cart_needs_shipping_address', '__return_true' );
- }
- return $needs_shipping;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement