2019-05-22 05:07
浏览 168


I need to hide all shipping methods when total in cart is below $40. I basically want to disable all shipping methods as I will be charging a $4 flat fee for each sample for all my zones.

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, '' );

need to remove the options below:

<td data-title="Transport Costs">
    <ul id="shipping_method">
            <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">&#36;</span>6.28</span></label>
            <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>

图片转代码服务由CSDN问答提供 功能建议

当购物车总额低于40美元时,我需要隐藏所有送货方式。 我基本上要禁用所有送货方式 因为我将为我的所有区域收取4美元的固定费用。

  if($ _SESSION [“sample_count”] == $ _SESSION [“cart_items_count”]){
 $ sample_count = $ _SESSION [“sample_count”]; \  n $ sample_shipping_cost = 4; 
 $ woocommerce-&gt; cart-&gt; add_fee('Samples Postage',($ sample_count * 4),true,''); 


 &lt; td data-title =“Transport 费用“&gt; 
&lt; ul id =”shipping_method“&gt; 
&lt; li&gt; 
&lt; 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'/&gt; 
&lt; label for =”shipping_method_0_wbs10065ab3a2_delivery“&gt;发货:&lt; span class =”woocommerce-Price-amount amount  “&gt;&lt; span class =”woocommerce-Price-currencySymbol“&gt;&amp;#36;&lt; / span&gt; 6.28&lt; / span&gt;&lt; / label&gt; 
&lt; / li&gt; 
&lt; li&gt;  ; 
&lt; input type =“radio”name =“shipping_method [0]”data-index =“0”id =“shipping_method_0_local_pickup16”value =“local_pickup:16”class =“shipping_method”/&gt; 
&lt;  label for =“shipping_method_0_local_pickup16”&gt;本地取件&lt; / label&gt; 
&lt; / li&gt; 
&lt; / ul&gt; 
  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题